MySQL table question

Posted on 2005-04-14
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


    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

     start_verse tinynt(3) NOT NULL,
    tinynt should be tinyint

    Author Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now