[SOLVED]Trouble getting php and mysql to work
Posted: Sat Oct 30, 2010 8:12 pm
Code: Select all
require_once "db.php";
require_once "dbconnect.php";
mysql_select_db("char", $link);
$sql= "INSERT INTO cc (plyr,char,nick,sex,lvl,exp,race,class,hp,ac,str,dex,con,int,wis,cha) values ('$_POST[plyr]','$_POST[char]','$_POST[nick]','$_POST[sex]','$_POST[lvl]','$_POST[exp]','$_POST[race]','$_POST[class]','$_POST[hp]','$_POST[ac]','$_POST[str]','$_POST[dex]','$_POST[con]','$_POST[int]','$_POST[wis]','$_POST[cha]')";
if (!mysql_query($sql,$link))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($link);Maybe I need some new eyes on this? please help? Ive looked up mysql.com and php.net and still cant figure out what Im doing wrongError: 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,nick,sex,lvl,exp,race,class,hp,ac,str,dex,con,int,wis,cha) values ('bob','B' at line 1
thanks,
gimpy