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
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):
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
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
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.
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