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 Chriss Miller 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
Joined
Aug 9, 2004
Messages
25
Location
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
 
Oh, thank you very much, it worked :D
 
Status
Not open for further replies.

Similar threads

Replies
2
Views
384
  • Locked
  • Question Question
Replies
2
Views
370
  • Locked
  • Question Question
Replies
19
Views
1K

Part and Inventory Search

Sponsor

Back
Top