Query Not Working
Posted
by John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2010-04-03T03:47:48Z
Indexed on
2010/04/03
3:53 UTC
Read the original article
Hit count: 445
Hello,
The simple query below is not working. Any idea why? When I echo the three variables, the correct values are returned, so I know I have variables.
Thanks in advance,
John
$comment = $_POST['comment'];
$uid = $_POST['uid'];
$subid = $_POST['submissionid'];
echo $comment;
echo $uid;
echo $subid;
mysql_connect("mysqlv12", "username", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$query = sprintf("INSERT INTO comment VALUES (NULL, '%s', '%s', '%s', NULL, NULL)", $uid, $subid, $comment);
mysql_query($query);
© Stack Overflow or respective owner