Yes I am yet another newbie to the world of PHP and MySQL and I can't get MySQL to make the table. I've been given full permissions from the admins of the site i'm using to host what will hopefully be a massive player database, but so far it's been a crash and burn. I can connect to the database fine and the version of MySQL is 4.0.12. It's probably something simple, but right now it's hurting my brain. Can anyone help me out? Thanks in advance.
Here's the error I get. It's a bit cut off for some reason but anyway:
MySql Error on: 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 'INDEX CHAR(100), year INDEX INT(4), team CHAR(3), G INT(6), AVG
Here's my code
$database = "basebal1_mbml1";
$user = "user";
$pass = "pass";
$hostname = "localhost";
$connection = mysql_pconnect($hostname, $user, $pass);
if (mysql_select_db("basebal1_mbml1")==TRUE)
{
print "DB selected<br>";
}
else
{
print "DB not selected";
}
echo mysql_get_server_info();
mysql_query("CREATE TABLE hitting(playername INDEX CHAR(100), year INDEX INT(4), team CHAR(3), g INT(6), avg DECIMAL(4,3), ab INT(6), h INT(6), doub INT(6), trip INT(6), hr INT(6), bb INT(6), k INT(6), sb INT(6), cs INT(6), r INT(6), rbi INT(6), slg DECIMAL(4,3), obp DECIMAL(4,3));", $connection) or die ("<br>MySql Error on : "mysql_error());
mysql_close($connection);