need help please

Discussion in 'MySQL' started by rojar123, Sep 13, 2007.

  1. #1
    Hi, i have a jokes website with jokes table database structure like this:

    CREATE TABLE `dd_items` (
    `ItemID` int(10) NOT NULL auto_increment,
    `ItemTitle` varchar(255) NOT NULL default '',
    `ItemCategory` int(10) NOT NULL default '0',
    `ItemSubcategory` int(10) NOT NULL default '0',
    `ItemText` text,
    `Contributor` varchar(50) NOT NULL default '',
    `DateAdded` int(10) NOT NULL default '0',
    `ItemType` varchar(10) NOT NULL default '',
    `ItemStatus` varchar(20) NOT NULL default 'unapproved',
    PRIMARY KEY (`ItemID`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

    but i just bought a dataabse with a table structure like this:


    CREATE TABLE `JOKES_BIG` (
    `Auto` INTEGER,
    `JokeCategory` VARCHAR(255),
    `JokeName` VARCHAR(255),
    `Joke` TEXT
    ) TYPE=MyISAM;

    is it possible for me to insert that data into my existing website?? Thnx any help would be greatly appreciated!!! thnx:)
     
    rojar123, Sep 13, 2007 IP
  2. Notting

    Notting Notable Member

    Messages:
    3,210
    Likes Received:
    335
    Best Answers:
    0
    Trophy Points:
    280
    #2
    Hi,

    You need a join command. Possibly something like this:

    <?php
    // Make a MySQL Connection
    // Construct our join query
    $query = "SELECT family.Position, food.Meal ".
     "FROM family, food ".
    	"WHERE family.Position = food.Position"; 
    	 
    $result = mysql_query($query) or die(mysql_error());
    
    
    // Print out the contents of each row into a table 
    while($row = mysql_fetch_array($result)){
    	echo $row['Position']. " - ". $row['Meal'];
    	echo "<br />";
    }
    ?>
    Code (markup):
     
    Notting, Sep 13, 2007 IP
  3. rojar123

    rojar123 Peon

    Messages:
    934
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hi thnx for the reply dude, but i am an absolute php/mysql noob, can u tell a method or code which i can add to the .sql file before uplaoding it on to the seever using php myadmin? cheers:)
     
    rojar123, Sep 14, 2007 IP
  4. fabriciogr

    fabriciogr Active Member

    Messages:
    958
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    73
    #4
    first question... the Joke database u bought.. how many rows are in it? is it small enough to sort this and import this manually?

    if not u'll have to create a script as by seeing ur tables u have a Joke and a Category table BUT the database u bought inserts the name of joke category directly into each row...

    anyhow i would need to know the table structure for your JokeCategory table
     
    fabriciogr, Sep 15, 2007 IP
  5. azoundria

    azoundria Member

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    Create a PHP script which grabs each entry of the database you bought and adds it to the first database. That's how I would do it anyways, although there might be an easier way.
     
    azoundria, Sep 15, 2007 IP
  6. rojar123

    rojar123 Peon

    Messages:
    934
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #6
    the jokes database has 10,000 jokes so its hard to insert manually. I am willing to give $5 if anyone can do it for me please:) cause i have nearly no php knowledge. thnx:D
     
    rojar123, Sep 16, 2007 IP