Error on Query Insert

This is to continue from the post you aided me, with the Include statement.

*pounces Johnathan and Skylar* IT WORKED.. I think it was that crummy '&' in there skylar, thanks for your coolness. Johnathan, thanks for your indepth clarrification of things, I hope your foot gets better soon. I myself am a data programmer, C++ and VB mainly. I am setting up a website for a friend as a favor, and boy... when I said "all programming languages are basically the same, I am sure I can help you out".. I put my foot in my mouth. hahaha. Thanks guys, you all are the best. Now for the strange thing:

$insert_data_Info = "INSERT INTO
$table1 (CharName, PlayerName, Password, Email,
Webpage, Age, Sex, Nature, Demeanor, Venue, Type,
Concept, Description, ExitMessage, Icon)
VALUES ('$CharName', '$PlayerName',

if(mysql_query($insert_data_Info, $connect))
print "Info added successfully.
else { print "Info addition failed.

$insert_data_atts = "INSERT INTO
$table2 (Str, Dex, Stam, Char, Manip, App, Perc,
intel, Wits)
VALUES ('$Str','$Dex','$Stam','$Char','$Manip','$App',

if(mysql_query($insert_data_atts, $connect))
print "Attribute added successfully.
print "Attribute addition failed.

$insert_data_tals = "INSERT INTO
$table3 (Alert,Aware,Athlet,Brawl,Dod,Express,Emp,
VALUES ('$Alertness','$Awareness','$Athletics','$Brawl',

if(mysql_query($insert_data_tals, $connect))
print "Talents added successfully.
else { print "Talents addition failed.

I didn't include the running of the query earlier skylar, because I figured the error was before that, there is much more code after as well, but all of it works great from the error loggs you taught me told me to read. The one that I can't seem to get to work is the ATTs one. The second query, all of them echo completed, only $insert_data_atts fails each time. The table is named correctly. Also, my friend is using a geocities business account thingie, how can I get her server, to show me the error loggs for MySql, or php error loggs as you said to check, since I am not running the server of my server.

the darthmoob


  • Be careful of reserved words in your queries.

    : [code]
    : $insert_data_atts = "INSERT INTO
    : $table2 (Str, Dex, Stam, Char, Manip, App, Perc,
    : intel, Wits)
    : VALUES ('$Str','$Dex','$Stam','$Char','$Manip','$App',
    : '$Perc','$intel','$Wits')";
    : [/code]
    CHAR is a reserved word in MySQL and SQL is not case sensitive. You need to put it between backticks, e.g.


    Note they are backticks (`) and not single quotes ('). There's nothing wrong with putting all field names in backticks if you want to be safe.

    : [code]
    : $insert_data_atts = "INSERT INTO
    : $table2 (`Str`, `Dex`, `Stam`, `Char`, `Manip`, `App`, `Perc`,
    : `intel`, `Wits`)
    : VALUES ('$Str','$Dex','$Stam','$Char','$Manip','$App',
    : '$Perc','$intel','$Wits')";
    : [/code]

    Hope this helps you get a bit further.


    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • [b][red]This message was edited by skylar at 2004-3-23 16:15:42[/red][/b][hr]
    I get this error when i run (a part of) that script

    You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Char, Manip, App, Perc, intel, Wi

    'Char' is a reserved word in mysql (i guess)
    You can't use it to define a column name

    Change it and it should work, it worked for me when i changed it..

    Instead i get a Table 'db.Atts' doesn't exist lol

    Good luck with the rest of the rebuilding process =)
    I was too slow lol, sorry jonathan

    [b][blue]Snoochie Boochies[/blue][/b]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!