Error in sql Syntax

basuhg

New member
Joined
Mar 9, 2009
Messages
1
hi every one,
this is my code when i execute it gives me error saying

Unable to create TableYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null, primary key(SRNUMBER))' at line 13

please guide me, where am i going wrong thanx in advance


<?php
//create Table
$con = mysql_connect("localhost","root","compaq");
if(!$con)
{
echo "</br>connection failed".mysql_error();
}
else
{
echo "</br>Connection Established";
}

mysql_select_db("ad", $con);
$a = mysql_query("create table ad(SRNUMBER float(8,4),
ANA varchar(10),
AGE date,
DESCRI text,
ESC enum('Y','N'),
CATE set('LRUN','ESC','KM','STUCK','SR'),
SEVE varchar(10),
COMMENTS varchar(10),
AUTO_FLAG tinyint(1),
MANA tinyint(1),
FREETEXT1 text(50000) default null,
FREETEXT2 text default null,
FREETEXT3 text) default null,
primary key(SRNUMBER))");
if(!$a)
{
echo "</br>Unable to create Table".mysql_error();
}
else
{
echo "</br>Table Created";
}
mysql_close($con);



?>
 
Use phpMyAdmin to create the table and then click the link "Create PHP Code"
 
Back
Top