Reguser.php error, Could Not Register, DB Error? [RESOLVED]

Location of the Videos
Post Reply
User avatar
Verahta
Posts: 440
Joined: Wed Aug 24, 2011 1:50 am

Reguser.php error, Could Not Register, DB Error? [RESOLVED]

Post by Verahta »

Man, maybe I'm just tired but for whatever reason I'm drawing a blank on why the heck I'm getting this error: "could not register, db error" in the code snippet below:

Code: Select all

else
{
$password = md5($password);

$SQL = "INSERT into players (name, password, email, level, exper) VALUES ['$player','$password','$email','1','0']";
mysql_query($SQL) or die("could not register, db error");

print "Thank you for registering a new account'";

Every time I click Submit on my register.php page, the reguser.php page throws up that error message which is the die function. I already fixed about 20 errors, turns out my monitor sucks cause what I thought were apostrophes in the YouTube videos were actually freakin exclamation marks! And where I had parenthesis were actually BRACKETS!!! I literally could not tell the difference on my screen, but figured it out from my basic understanding of the syntax. So, after the last hour of fixing my own mistakes, I know can't seem to work out what's wrong. Oh and get this, my first error? I forgot to include the connect.php file at the top of my reguser script :shock:

Took me 20 minutes to realize that it was missing :oops:
Last edited by Verahta on Mon Sep 05, 2011 6:33 am, edited 2 times in total.
"In order to understand recursion, one must first understand recursion".
User avatar
Lord Strife
Posts: 104
Joined: Wed Oct 28, 2009 3:10 pm

Re: Reguser.php error, Could Not Register, DB Error?

Post by Lord Strife »

Code: Select all

$SQL = "INSERT into players (name, password, email, level, exper) VALUES ['$player','$password','$email','1','0']";
should be

Code: Select all

$SQL = "INSERT into players (name, password, email, level, exper) VALUES ('$player','$password','$email','1','0')";
User avatar
Verahta
Posts: 440
Joined: Wed Aug 24, 2011 1:50 am

Re: Reguser.php error, Could Not Register, DB Error?

Post by Verahta »

Oh wow, brackets/parentheses on YouTube strike again... :x


Thank you Lord Strife, It worked and the new player was entered into the db successfully, I think I had that correct at one point, and then changed it, thinking I was fixing the syntax :twisted:
"In order to understand recursion, one must first understand recursion".
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Reguser.php error, Could Not Register, DB Error?

Post by Jackolantern »

Yeah, it can be hard to tell the difference on video. Just remember square brackets are not used very often in PHP. If I am remembering clearly, I think they are only used for array indices.

Can you mark this as resolved in the title by editing the original post? :)
The indelible lord of tl;dr
Post Reply

Return to “Older Browser MMO Videos”