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

x
?
Solved

MySQL table question

Posted on 2005-04-14
3
Medium Priority
?
258 Views
Last Modified: 2013-12-12
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
0
Comment
Question by:mhoggatt1
3 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 13784827
Michael,

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', '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?
<?php
 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

-r-
0
 
LVL 33

Accepted Solution

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

Author Comment

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

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