Page 1 of 1

Nothing being added to table...

Posted: Wed Jul 30, 2003 2:54 pm
by Trip1
http://tsn.dk/p/?id=1940

Line 55-57.. For some reason everything seems to be working but nothing is added into my table. I tried using a different method:

їphp]
$sql = "INSERT INTO users (username, password, signature, profile, real name, ipaddress) VALUES ('$username', '$password', '$signature', '$profile', '$realname', '$ip')";

ї/php]
and then using
їphp]
mysql_query($sql);
ї/php]

Got the same result, looked like it worked, no errors, but nothing was added into the table. So i echoed out $sql. Looked perfect, i ran it through the SQL thing in phpmyadmin and the record was created successfully with no errors from MYSQL.. I have no idea what's wrong.. any help appreciated, thanks in advance.


?>

Posted: Wed Jul 30, 2003 9:14 pm
by toshesh
Not sure but dont you need to receive it when you call mysql_query?
you havent specified a database either.
like
$result = mysql_query($dbconn, $sql);

Posted: Wed Jul 30, 2003 10:38 pm
by McGruff
What happens if you try it with:

Code: Select all

<?php

$sql = "INSERT INTO users SET col1='$var1', col2='$var2', etc..";

?>

Posted: Wed Jul 30, 2003 11:42 pm
by toshesh
as long as the query works when running on the sql server then php shouldn't have any problems with the query.

But isn't that suppose to use ALTER TABLE command?

Posted: Thu Jul 31, 2003 7:02 am
by twigletmac
Do you get anything reported if you do:

Code: Select all

$sql = "INSERT INTO users (username, password, signature, profile, real name, ipaddress) VALUES ('$username', '$password', '$signature', '$profile', '$realname', '$ip')"; 

mysql_query($sql) or die(mysql_error().'<p>'.$sql.'</p>');
Mac

Posted: Thu Jul 31, 2003 8:37 pm
by McGruff
Twig probably has a better suggestion (adding mysql_error) to help you track down the problem but here's a snippet from the mysql manual (mysql.com):

"The INSERT ... VALUES form with multiple value lists is supported in MySQL Version 3.22.5 or later. The col_name=expression syntax is supported in MySQL Version 3.22.10 or later. "