Page 1 of 1

[help] Error trying to add to database

Posted: Wed Jan 06, 2010 12:57 pm
by painful-one
abushahin wrote:
Hey to insert data into db you need to create a form then let php insert it for you, to retrieve data you'll need to create a form to retrieve it for you. you can have a look at hows its done here

<<http://abushahin.eu/tutorials/insertdata.php>>

Hey, hope you can help me. If not, thanks anyway.

I checked out the website you sent me and set everything up but I am still getting a DB error. This is what I have so far. I have a login for users (as of right now I have to manually add the information to create a new member in the members table, which is fine at the moment). It checks the username and password, connects on success. I want them to be able to change the information in the database, so as they progress, they can change it. I did the tutorial you sent me and I get this error;

Parse error: syntax error, unexpected ';' in /home/content/96/4742196/html/add.php on line 9

Line 9 is;

mysql_query("INSERT INTO members VALUES('$charname')" or die ('Error, INSERT to users query failed');

I changed everything to charname on the html/php side and whatnot.

And ideas?

Re: [help] Error trying to add to database

Posted: Wed Jan 06, 2010 1:00 pm
by AbraCadaver
Syntax errors mean that you have mistyped something or are missing something that needs a match such as a quote or parentheses. In your case it's parentheses on that line.

Re: [help] Error trying to add to database

Posted: Wed Jan 06, 2010 4:51 pm
by painful-one
So what do I change? Where do I put them?

Re: [help] Error trying to add to database

Posted: Wed Jan 06, 2010 5:23 pm
by Darhazer

Code: Select all

mysql_query("INSERT INTO members VALUES('$charname')" or die ('Error, INSERT to users query failed');
 
Should be

Code: Select all

mysql_query("INSERT INTO members VALUES('$charname')") or die ('Error, INSERT to users query failed');