SQL: converting databases
Posted: Tue Feb 13, 2007 1:45 am
I'm trying to convert some database which I can set in the proper format but some of the text had SQL operators in it.
my code to create the dump
Code: Select all
INSERT INTO `t_media`
VALUES ( 334, 'game', 'WhoopAss: Office Edition', 'WhoopAss-Office-Edition, '
CHANGE angle
AND power
TO catapult obstacles at employees before they reach the water cooler. ', '', '', 'gst_1.SWF ', '', 'gst_1.png ', 1, '2007 -02 -1302 :29 :09 ', 0, 0, 0, 0, 'WhoopAss : Office Edition ', '', '', 'Y ', '', '') INSERT INTO `t_media` VALUES (335, 'game ', 'Brown Cow Curling ', 'Brown - Cow - Curling, 'Play a match of curling against your friend or the computer.', '', '', 'gst_2.SWF', '', 'gst_2.png', 1, '2007-02-13 02:29:09', 0, 0, 0, 0, 'Brown Cow Curling', '', '', 'Y', '', '' )my code to create the dump
Code: Select all
$result = mysql_query( "SELECT * FROM games" )or die("SELECT Error: ".mysql_error());
$counter = 334;
while($row=mysql_fetch_array($result) )
{
$title = $row['gametitle'];
$url = str_replace(" ", "-",str_replace(":","",$row['gametitle']));
$desc = $row['gamedesc'];
$file = $row['gamefile'];
$thumb = $row['gameicon'];
$tags = $row['gamekeywords'];
if (strpos($file, ".DCR") == false)
{
echo "INSERT INTO `t_media` VALUES ($counter, 'game', '$title', '$url, '$desc', '', '', '$file', '', '$thumb', 1, '2007-02-13 02:29:09', 0, 0, 0, 0, '$tags', '', '', 'Y', '', '')<br>";
$counter = $counter + 1;
}
}