On my database I have 2 tables tbl_moderatefiles and tbl_files. I am trying to write a query that will move the a record from tbl_moderatefiles to tbl_files. Below is my current code:
CODE
<?
//connect to database//
$db_name = "ilovephysics";
$connection = @mysql_connect("localhost","jeansy","molanza123") or die(mysql_error());
$db= @mysql_select_db($db_name,$connection) or die(mysql_error());
$id=$_GET['ID'];
//assign a SQL query text to a variable//
$sql="SELECT * FROM tbl_moderatefiles WHERE ID=$id";
//run the query//
$result = @mysql_query($sql) or die(mysql_error());
//count number of rows in output//
$numrows = mysql_numrows($result);
//each time the loop executes, assign a value from the database to variables//
$date=mysql_result($result,$i,"date");
$time=mysql_result($result,$i,"time");
$title=mysql_result($result,$i,"title");
$category=mysql_result($result,$i,"category");
$description=mysql_result($result,$i,"description");
$name=mysql_result($result,$i,"name");
$type=mysql_result($result,$i,"type");
$size=mysql_result($result,$i,"size");
$content=mysql_result($result,$i,"content");
$sql2="INSERT INTO tbl_files (date, time, title, category, description, name, type, size, content),
VALUES ('$date', '$time', '$title', '$category', '$description', '$name', '$type', '$size', '$content')";
//run the query//
$result2 = @mysql_query($sql2) or die(mysql_error());
?>
But evertime I run the code I get the error:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' VALUES ('2008/03/11', '19:15:49', 'Test', 'Acoustics', 'Testing', 'cursor_hand' at line 1".
Why can't anything in PHP be simple lol?
Thanks in advance.
This post has been edited by jeansymolanza: 11 Mar, 2008 - 12:18 PM