Question about PHP and MySql??????

  • Thread starter Thread starter Bertrum
  • Start date Start date
B

Bertrum

Guest
Hello,

I am currently trying to make my Sql table on a server, below is the code:

<?php
$con = mysql_connect("localhost","my id","my id");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my id", $con);
echo "db selected & connected to $con";
$sql = "CREATE TABLE person
(

Firstname varchar(20),
Lastname varchar(20),
Email varchar(50),
)";
mysql_query($sql,$con); // here is where the table
//actually gets created


if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
else
{
echo ("table successfully created");
}


mysql_close($con);
?>



But when I try to run this once (which I need to do to create the table) I get the following error message:

db selected & connected to Resource id #2Error: 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 ')' at line 7.

Does anyone know why this is?

Cheers guys!
k i took out that extra comma and got this message:

db selected & connected to Resource id #2Error: Table 'person' already exists


so this means Its done?
 
Back
Top