View previous topic :: View next topic |
Author |
Message |
XvObiVx -
Joined: 01 May 2004 Posts: 9
|
Posted: Thu May 06, 2004 1:20 am Post subject: MySQL uploading |
|
|
Ok well I had a problem loading a variable into a database. It looked like this:
Code: |
$sql = "INSERT INTO users VALUES ('','$_POST['user']','1')";
mysql_query($sql);
|
(The first '' is an empty variable.)
Ok, to the problem. Well, since I had the next set of quotes in the $_POST command, it messed up the input. Is there anyway I can interchange the quotes? I fixed the problem by loading the $_POST variable into a normal local variable, and then fired that into the database. Thanks for any replies. |
|
Back to top |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Thu May 06, 2004 2:18 am Post subject: |
|
|
Try:
_________________ Bienvenidos! |
|
Back to top |
 |
 |
XvObiVx -
Joined: 01 May 2004 Posts: 9
|
Posted: Thu May 06, 2004 9:25 pm Post subject: |
|
|
Yea, I tried using "", but it didn't work. |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Fri May 07, 2004 2:57 pm Post subject: Re: MySQL uploading |
|
|
There is a syntax error in your code. Try:
Code: |
$sql = "INSERT INTO users VALUES ('','" . $_POST['user'] . "','1')";
mysql_query($sql);
|
_________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
|