MySQL uploading

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
XvObiVx
-


Joined: 01 May 2004
Posts: 9

PostPosted: Thu May 06, 2004 1:20 am    Post subject: MySQL uploading Reply with quote

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 View user's profile Send private message
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Thu May 06, 2004 2:18 am    Post subject: Reply with quote

Try:
Code:
$_POST["user"]

_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
XvObiVx
-


Joined: 01 May 2004
Posts: 9

PostPosted: Thu May 06, 2004 9:25 pm    Post subject: Reply with quote

Yea, I tried using "", but it didn't work.
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri May 07, 2004 2:57 pm    Post subject: Re: MySQL uploading Reply with quote

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 View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group