Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Error on Query Insert

darthmoobeydarthmoobey Posts: 140Member
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:

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

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',
'$Perc','$intel','$Wits')";

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

$insert_data_tals = "INSERT INTO
$table3 (Alert,Aware,Athlet,Brawl,Dod,Express,Emp,
Intim,Lead,Leger,Subt,Pers,Tal1,Tal2,Tal1_Sc,
Tal2_Sc)
VALUES ('$Alertness','$Awareness','$Athletics','$Brawl',
'$Dodge','$Expression','$Empathy','$Intimidation',
'$Leadership','$Legerdemain','$Subterfuge',
'$Persuasion','$Talent1','$Talent2',
'$Talent1_Score','$Talent2_Score')";

if(mysql_query($insert_data_tals, $connect))
{
print "Talents added successfully.
";
}
else { print "Talents addition failed.
";
}
[/code]

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

Comments

  • JonathanJonathan Posts: 2,914Member
    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.

    `Char`

    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.

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • skylarskylar Posts: 82Member
    [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.