[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


MySQL table question

Posted on 2005-04-14
Medium Priority
Last Modified: 2013-12-12
I am getting an error on my table code. What am I doing wrong ?

$query = "
  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,

mysql_query($query, $mysql_access) or die("Sql error : " . mysql_error());
Question by:mhoggatt1
LVL 49

Expert Comment

ID: 13784827

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,
  $connection = mysql_connect('localhost', 'username', 'password') or die('Could not connect to the database');
?> (You have to replace localhost/username/password with appropriate values.

2) Have you selected a database as to where the table should be created in?
 mysql_select_db('databasename', $connection); //the code above should also be in this file

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

LVL 33

Accepted Solution

snoyes_jw earned 600 total points
ID: 13785093
 start_verse tinynt(3) NOT NULL,
tinynt should be tinyint

Author Comment

ID: 13785223
Hi snoyes,
   Thanks for your help. I knew it had to be something I was overlooking.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month18 days, 22 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question