Jump to content


Photo

help, script error!


  • Please log in to reply
26 replies to this topic

#21 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 10 August 2006 - 03:00 AM

Username and password are reserved words. Put backticks around them if you must use those column names.

$query = "INSERT INTO $table_users (id, first_name, last_name, email_address, `username`, `password`, signup_date) VALUES('$userid', '$first_name', '$last_name', '$email_address', '$username', '$mdpwd', '$today')";
echo $query;
$sql = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);

Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#22 newb

newb
  • Members
  • PipPipPip
  • Advanced Member
  • 454 posts

Posted 10 August 2006 - 03:01 AM

didnt help, same error i believe.

INSERT INTO (id, first_name, last_name, email_address, `username`, `password`, signup_date) VALUES('0', 'fgfgf', 'gfdg', 'gfdg', 'gfdg', 'c43f0cf37469a3f1b20342132b0451de', 'August 9, 2006, 10:02 pm')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 '(id, first_name, last_name, email_address, `username`, `password`, signup_date) ' at line 1 with query INSERT INTO (id, first_name, last_name, email_address, `username`, `password`, signup_date) VALUES('0', 'fgfgf', 'gfdg', 'gfdg', 'gfdg', 'c43f0cf37469a3f1b20342132b0451de', 'August 9, 2006, 10:02 pm')



#23 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 10 August 2006 - 03:04 AM

These are definitely the correct column names?
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#24 newb

newb
  • Members
  • PipPipPip
  • Advanced Member
  • 454 posts

Posted 10 August 2006 - 03:05 AM

yeah they are.

#25 newb

newb
  • Members
  • PipPipPip
  • Advanced Member
  • 454 posts

Posted 10 August 2006 - 03:07 AM

just to be sure, just ran the query in phpMyAdmin, and it executed properly...so its definitely something with php :s

phpMyAdmin returned this:

Inserted rows: 1
Inserted row id: 1 (Query took 0.0003 sec)
SQL query: INSERT INTO p16_users( id, first_name, last_name, email_address, `username` , `password` , signup_date )
VALUES (
'$userid', '$first_name', '$last_name', '$email_address', '$username', '$mdpwd', '$today'
)



#26 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 10 August 2006 - 03:21 AM

So when you use p16_users as the table name in phpMyAdmin it works and when you use $table_users in your script it fails ... which suggests that $table_users has no value in your script. And that's exactly what the echoed query shows.  $table_users isn't properly defined or available to your script as having the value p16_users.
Legend has it that reading the manual never killed anyone.
My site

#27 newb

newb
  • Members
  • PipPipPip
  • Advanced Member
  • 454 posts

Posted 10 August 2006 - 03:38 AM

U WERE RIGHT. O.O




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users