Jump to content

Recommended Posts

I get an error with this table.  I suspect it is in the enum line but it LOOKS ok to me!

 

Error: 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 '(20) NOT NULL, procedure varchar(20) NOT NULL, proc_type enum (`GC`,`NS`,`' at line 5: CREATE TABLE procedures ( proc_id int(11) NOT NULL auto_increment, pt_id int(11) NOT NULL, proc_date date(20) NOT NULL, procedure varchar(20) NOT NULL, proc_type enum (`GC`,`NS`,`Staff`) NOT NULL, dx varchar(20) NOT NULL, PRIMARY KEY (proc_id) )

 

<?php 

include ("connectdb.php");


$sql = "CREATE TABLE procedures
(
  proc_id int(11) NOT NULL auto_increment,
  pt_id int(11) NOT NULL,
  proc_date date(20) NOT NULL,
  procedure varchar(20) NOT NULL,
  proc_type enum ('GC','NS','Staff') NOT NULL,
  dx varchar(20) NOT NULL,
  
  PRIMARY KEY  (proc_id)
)";

// Execute query
mysql_query($sql) or die(mysql_error().": $sql");


?>

Link to comment
https://forums.phpfreaks.com/topic/137413-solved-one-more-table-question/
Share on other sites

ok, this worked in mysql:

 

<?php 

include ("connectdb.php");


$sql = "CREATE TABLE `procedures` (
  `proc_id` int(11) NOT NULL auto_increment,
  `pt_id` int(11) NOT NULL,
  `proc_date` date NOT NULL,
  `procedures` varchar(20) NOT NULL,
  `proc_type` enum('GC','NS','Staff') default NULL,
  `dx` varchar(20) NOT NULL,
  PRIMARY KEY  (`proc_id`)
)";

// Execute query
mysql_query($sql) or die(mysql_error().": $sql");


?>

corrected......

<?php 

include ("connectdb.php");


$sql = "CREATE TABLE `procedures` (
  `proc_id` int(11) NOT NULL auto_increment PRIMARY KEY,
  `pt_id` int(11) NOT NULL,
  `proc_date` date NOT NULL,
  `procedures` varchar(20) NOT NULL,
  `proc_type` enum('GC','NS','Staff') NOT NULL,
  `dx` varchar(20) NOT NULL)";

// Execute query
mysql_query($sql) or die(mysql_error().": $sql");

?>

Yes good lesion here, All mysql error's are before the error line what is shown.

 

So if it says line 5 like it did trust me it on line 4 lol.

 

weired but true..

 

For some reason mysql spits the line afther the error out but we no it the line before..

 

make no scence when it tells you it the line it showing like line 5 but problam on line 4.

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.