MYSQL INSERT

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

MYSQL INSERT

Post by Parody »

Anything wrong with this:

Code: Select all

mysql_connect("localhost", "admin", "ak7456") or die(mysql_error());
mysql_select_db("users") or die(mysql_error());
$regdate = date('m d, Y');
mysql_query("INSERT INTO users('".$_POST['uname']."', '$rand', '".$_POST['email'].")";
mysql_query("INSERT INTO stats('".$_POST['uname']."','$character', '100', '2000', '001', '01', 000, '01', '01', '01', '1', '0', '00000000', '00000000', '00000000', '00000000')");
I get this error for some reason:

Code: Select all

Parse error: parse error in c:\program files\eas1yphp1-8\www\registertmp.php on line 75
Line 75 is the first mysql_query , this one:

Code: Select all

mysql_query("INSERT INTO users('".$_POST['uname']."', '$rand', '".$_POST['email'].")";
ALL HELP APPRECIATTED :D
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Re: MYSQL INSERT

Post by Buddha443556 »

Parody wrote:Line 75 is the first mysql_query , this one:

Code: Select all

mysql_query("INSERT INTO users('".$_POST['uname']."', '$rand', '".$_POST['email'].")";
Your missing a single quote for $_POST['email'] value.

Code: Select all

mysql_query("INSERT INTO users('".$_POST['uname']."', '$rand', '".$_POST['email']."')";
I have no idea why the parse error, check for other quote problems above line 75.
User avatar
artexercise
Forum Commoner
Posts: 33
Joined: Thu Nov 20, 2003 9:38 am
Location: Raleigh, NC

Post by artexercise »

Code: Select all

mysql_query(&quote;INSERT INTO users('&quote;.$_POSTї'uname'].&quote;', '$rand', '&quote;.$_POSTї'email'].&quote;')&quote;);
missing the close parantheses on the mysql_query also. Added it above.

JOE--
Post Reply