Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax Question 1

Status
Not open for further replies.

pollock77

Programmer
Aug 9, 2004
25
US
I'm not sure why this code isn't working.
Code:
  $data="('$_POST[username]', '$_POST[PASSWORD]', '$_POST[handle]', '$_POST[rank]', '$_POST[group]', '$_POST[gender]', '$_POST[av]')"
   $result3 = mysql_query("INSERT INTO users $data")
   or die(mysql_error()); 
   echo "Account successfully updated. Click [<a href='editor.cgi'>here</a>] to go back.";

I get this error:
Parse error: parse error, unexpected T_VARIABLE in /home/pollock7/public_html/new/editor.php on line 73

I'm not sure if I've looked at one too many semicolons or if I'm messing up some syntax, but can someone help?
 
pollock77,

Just casually looking at it, I'd try it as:

Code:
  $data="('$_POST[username]', '$_POST[PASSWORD]', '$_POST[handle]', '$_POST[rank]', '$_POST[group]', '$_POST[gender]', '$_POST[av]')";


Wishdiak
 
Yes, that helps, but now I'm ending up with an SQL error in syntax.
 
I did that and got this error:

Check the manual that corresponds to your MySQL server version for the right syntax to use near ' 'pass', 'Francis Spunkle', 'Admin', 'admin3', 'm', '
 
pollock77,

One last shot in the dark before I whip out an actual tree-book. I'd try:

Code:
$result3 = mysql_query("INSERT INTO users VALUES $data")or die(mysql_error());

Wishdiak
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top