joeysarsenal Posted September 15, 2007 Share Posted September 15, 2007 Im trying to create a database. Which has been created and i have many tables within the database but when i go to create my "Supplies" Table i get this error. Coding is below <?php $host = "localhost"; $user = "root"; $pass = ""; $Connect = @mysql_connect($host, $user, $pass); if(!$Connect){ echo('<p>Unable to connect to the' . ' database server at this time.</p>'); exit(); } mysql_select_db("Cool"); $sql = "CREATE TABLE Services(" . "Service_ID int(4) NOT NULL AUTO_INCREMENT PRIMARY KEY," . "Service_Name varchar(100) NOT NULL," . "Service_Type varchar(50) NOT NULL," . "Service_Cost varchar(20) ," . "Service_Requirement varchar(20),". "Staff_ID varchar(20);"; echo "SQL is " . $sql . "<br />"; if(mysql_query($sql)){ echo("<p>Services table successfully created!</p>"); } else{ print("<p>Error creating Services table: " . mysql_error() . "</p>"); } ?> I get this error SQL is CREATE TABLE Supplys(Supply_ID int(4) NOT NULL AUTO_INCREMENT PRIMARY KEY,Supply_Name varchar(100) NOT NULL,Supply_Type varchar(50) NOT NULL,Supply_Cost varchar(20) ,Supply_Availble varchar(20),Staff_ID varchar(20); Error creating Supplys table: 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 1 Link to comment https://forums.phpfreaks.com/topic/69446-solved-mysql-with-php-table-creating/ Share on other sites More sharing options...
leafface Posted September 15, 2007 Share Posted September 15, 2007 The outer () is not closed at the end ... Staff_ID varchar(20)); Link to comment https://forums.phpfreaks.com/topic/69446-solved-mysql-with-php-table-creating/#findComment-348960 Share on other sites More sharing options...
joeysarsenal Posted September 15, 2007 Author Share Posted September 15, 2007 ahh i knew it was something simple. Thank you for your help. Link to comment https://forums.phpfreaks.com/topic/69446-solved-mysql-with-php-table-creating/#findComment-349057 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.