mhoggatt1
asked on
MySQL table question
I am getting an error on my table code. What am I doing wrong ?
$query = "
CREATE TABLE john (
ID int(11) NOT NULL auto_increment,
chapter tinyint(3) NOT NULL,
start_verse tinynt(3) NOT NULL,
end_verse tinyint(3) NOT NULL,
sermon_title text NOT NULL,
PRIMARY KEY (ID))";
mysql_query($query, $mysql_access) or die("Sql error : " . mysql_error());
Thanks,
Michael
$query = "
CREATE TABLE john (
ID int(11) NOT NULL auto_increment,
chapter tinyint(3) NOT NULL,
start_verse tinynt(3) NOT NULL,
end_verse tinyint(3) NOT NULL,
sermon_title text NOT NULL,
PRIMARY KEY (ID))";
mysql_query($query, $mysql_access) or die("Sql error : " . mysql_error());
Thanks,
Michael
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi snoyes,
Thanks for your help. I knew it had to be something I was overlooking.
Thanks for your help. I knew it had to be something I was overlooking.
Although it would be easiest for us if you could show us the exact error that is outputted by the mysql_error() command, there are several things you can check.
1) Have you made a valid connection to a mysql server using mysql_connect()? ie,
<?php
$connection = mysql_connect('localhost',
?> (You have to replace localhost/username/passwor
2) Have you selected a database as to where the table should be created in?
<?php
mysql_select_db('databasen
?>
3) Are you sure that there is no table called "john" in the mysql database?
There might also be some problem on the "not null" phrases, but best would be if you could provide us with the error message.
Kind regards
-r-