Home » Technical Support » Other » PHP issue
Re: PHP issue [message #439274 is a reply to message #439272] |
Thu, 11 November 2010 12:37 |
|
danpaul88
Messages: 5795 Registered: June 2004 Location: England
Karma:
|
General (5 Stars) |
|
|
cnc95fan wrote on Thu, 11 November 2010 19:15 |
mysql_query("INSERT INTO USERS ('id','user','password') VALUES ('$regnum','$_POST['user']','$_POST['pass']')");
|
You can't use things like $_POST['pass'] directly in a string, you have to either put curly braces around the variables;
mysql_query("INSERT INTO USERS ('id','user','password') VALUES ('{$regnum}','{$_POST['user']}','{$_POST['pass']}')");
Or concatenate them with the string
mysql_query("INSERT INTO USERS ('id','user','password') VALUES ('".$regnum."','".$_POST['user']."','".$_POST['pass']."')");
My personal preference is the second method (concatenation), but it really doesnt matter which you use. The first variable ($regnum) is actually OK without these, but its good practice to follow the same method for all variables as it makes it clear what you were intending to do.
For more information;
http://www.php.net/manual/en/language.types.string.php#language.types.string.par sing
[Updated on: Thu, 11 November 2010 12:42] Report message to a moderator
|
|
|
|
|
PHP issue
By: cnc95fan on Fri, 05 November 2010 16:24
|
|
|
Re: PHP issue
By: Omar007 on Fri, 05 November 2010 16:46
|
|
|
Re: PHP issue
By: cnc95fan on Fri, 05 November 2010 16:51
|
|
|
Re: PHP issue
By: Omar007 on Fri, 05 November 2010 16:55
|
|
|
Re: PHP issue
By: Crimson on Fri, 05 November 2010 17:18
|
|
|
Re: PHP issue
|
|
|
Re: PHP issue
By: cnc95fan on Mon, 08 November 2010 15:35
|
|
|
Re: PHP issue
|
|
|
Re: PHP issue
By: cnc95fan on Thu, 11 November 2010 12:15
|
|
|
Re: PHP issue
|
|
|
Re: PHP issue
By: cnc95fan on Thu, 11 November 2010 12:43
|
|
|
Re: PHP issue
|
|
|
Re: PHP issue
By: cnc95fan on Fri, 12 November 2010 16:06
|
|
|
Re: PHP issue
|
|
|
Re: PHP issue
By: cnc95fan on Sun, 14 November 2010 12:40
|
|
|
Re: PHP issue
|
|
|
Re: PHP issue
By: cnc95fan on Tue, 16 November 2010 15:09
|
|
|
Re: PHP issue
|
|
|
Re: PHP issue
By: Zion on Tue, 16 November 2010 16:40
|
|
|
Re: PHP issue
By: Ethenal on Tue, 16 November 2010 22:44
|
|
|
Re: PHP issue
By: cnc95fan on Sat, 20 November 2010 13:51
|
|
|
Re: PHP issue
By: Omar007 on Sat, 20 November 2010 16:04
|
|
|
Re: PHP issue
By: cnc95fan on Sat, 20 November 2010 16:07
|
|
|
Re: PHP issue
|
|
|
Re: PHP issue
By: cnc95fan on Sun, 21 November 2010 16:14
|
|
|
Re: PHP issue
|
|
|
Re: PHP issue
By: cnc95fan on Mon, 06 December 2010 09:13
|
|
|
Re: PHP issue
|
|
|
Re: PHP issue
By: cnc95fan on Mon, 06 December 2010 11:30
|
|
|
Re: PHP issue
|
|
|
Re: PHP issue
By: cnc95fan on Mon, 06 December 2010 15:56
|
|
|
Re: PHP issue
|
|
|
Re: PHP issue
By: cnc95fan on Tue, 07 December 2010 06:09
|
|
|
Re: PHP issue
|
|
|
Re: PHP issue
By: cnc95fan on Tue, 07 December 2010 11:52
|
|
|
Re: PHP issue
|
|
|
Re: PHP issue
By: cnc95fan on Tue, 07 December 2010 11:58
|
|
|
Re: PHP issue
By: cnc95fan on Sun, 06 February 2011 10:14
|
Goto Forum:
Current Time: Fri Nov 22 19:24:20 MST 2024
Total time taken to generate the page: 0.01079 seconds
|