Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create table error

Status
Not open for further replies.

callshakeel

Programmer
Apr 11, 2003
10
IN
Error in creating table in MS SQL using PHP script;

code is as below:
$qstr="CREATE TABLE Catagory(catID int(4) NOT NULL, catName varchar (15) NOT NULL,description text NULL PRIMARY KEY catID)";
$result = $conn->Execute($qstr);

$qstr="CREATE TABLE Item(itemID int(4) NOT NULL, catID int(4) NOT NULL,itemName varchar (15) NOT NULL, itemType varchar (15) NOT NULL, description text NULL PRIMARY KEY itemID FOREIGN KEY Catagory.catID)";
$result = $conn->Execute($qstr);

I'm getting the following error:
Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft OLE DB Provider for ODBC Drivers Description: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'catID'. in c:\inetpub\ on line 8

Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft OLE DB Provider for ODBC Drivers Description: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'itemID'. in c:\inetpub\ on line 11


plz help me...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top