 |
Results from the most recent live auction are here.
21 members in the live chat room. Join Chat!
| |
06-02-2006, 09:36 AM
|
· #1 | | Senior Member Name: Zubair Location: Ontario Canada Join Date: May 2005
Posts: 2,754
NP$: 724.15 ( Donate)
| query problem again Hey
Whats wrong wid this code now PHP Code: @mysql_select_db($database) or die( "Unable to select database");
$query= 'INSERT INTO `user` (`id`, `username`, `pass`, `email`, `lastlogin`, `health`, `country`, `level`, `armysize`) VALUES (NULL, $username, $pass, $email, NULL, \'100\', $country, \'1\', \'1\');';
mysql_query($query);
its not giving any error but instead of adding whats in $username its adding the "$username" into the database.. |
| |
06-02-2006, 10:01 AM
|
· #2 | | Eating Pie Name: Steve Location: Canada Join Date: Nov 2004
Posts: 2,284
NP$: 91.30 ( Donate)
| Change it too this. PHP Code: @mysql_select_db($database) or die( "Unable to select database");
$query= "INSERT INTO user ('username', 'pass', 'email', 'lastlogin', 'health','country', 'level', 'armysize') VALUES ($username, $pass, $email, NULL, \'100\', $country, \'1\', \'1\')";
mysql_query($query);
All use " (double quotes) while setting the mysql query. Also ` are extremely slow. So use ' insted.
" = text & variables
' = text (variables are thought of as text)
- Steve |
| |
06-02-2006, 10:11 AM
|
· #3 | | Senior Member Name: Thomas White Location: England Join Date: Sep 2005
Posts: 1,033
NP$: 31.15 ( Donate)
| $query= "INSERT INTO `user` (`id`, `username`, `pass`, `email`, `lastlogin`, `health`, `country`, `level`, `armysize`) VALUES (NULL, $username, $pass, $email, NULL, \'100\', $country, \'1\', \'1\')";
That should do it...I think. |
| |
06-02-2006, 11:08 AM
|
· #4 | | NamePros Regular Name: Derek Location: Seattle, Wa Join Date: Jul 2004
Posts: 597
NP$: 69.00 ( Donate)
| PHP Code: @mysql_select_db($database) or die("Unable to select database");
$query= "INSERT INTO user(id, username, pass, email, lastlogin, health, country, level, armysize) VALUES (NULL, '$username', '$pass', '$email', NULL, 100, '$country', 1, 1)";
mysql_query($query);
That'll do it. |
| |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | |