473,394 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Why won't my table create with PHP? even when it gives me no error?

Hello, newbie here. I have been developing for the web for years, but db'ing has never been my thing.

Its a Linux server running MySQL: 4.1

I have written a small script in PHP to create a table. (Now let me sideline this by saying I could use phpMyAdmin to create the table. but I would like to do this via script just so I can learn how)

I bring up the PHP script in a browser and it gives me no errors. When I check my database, there are no tables (STILL). What am I missing?

I declared the variables (user, hostname, password, and database) then coded the following:

[PHP]mysql_connect($hostname,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="CREATE TABLE sellerInfo (sellerID int(8) NOT NULL auto_increment,userID varchar(12) NOT NULL,password varchar(12) NOT NULL,email varchar(34) NOT NULL,paypalEmail varchar(35) NOT NULL,companyName varchar(50) NOT NULL,firstName varchar(15) NOT NULL,lastName varchar(15) NOT NULL,streetAddress varchar(35) NOT NULL,city varchar(20) NOT NULL,state varchar(20) NOT NULL,country varchar(320) NOT NULL,postalCode varchar(10) NOT NULL,role varchar(10) NOT NULL,TOS varchar(3) NOT NULL,over18 varchar(3) NOT NULL,PRIMARY KEY (seller_ID),UNIQUE id (seller_ID),KEY id_2 (seller_ID))";
mysql_close();
[/PHP]
Mar 21 '07 #1
1 1185
I don't know why it happens, but I always spend several days trying to figure things out, but the moment I post a request for help, I figure it out!

I had changed the name of one of the fields and hadn't carried it all the way through.

Glad to find this anyway - I think I will be using it alot:)
Mar 21 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Andrew Metcalfe | last post by:
I'm having trouble writing a simple procedure. I'm trying to simply select against a table in a different schema. I first wrote a simple procedure that selected against a table in my schema,...
7
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to...
7
by: Jon Combe | last post by:
I have created the following test SQL code to illustrate a real problem I have with some SQL code. CREATE TABLE JCTable ( CustomerName varchar(50) ) ALTER TABLE JCTable ADD CustomerNo int...
2
by: Konrad L. M. Rudolph | last post by:
Hello, For some weeks now I seem to be unable to create new projects in Visual Studio 2003. It does not matter which language I use, nor which project type I want to create. As soon as I...
16
by: mamo74 | last post by:
Hello. I am administering a SQL Server (Enterprise Edition on Windows 2003) from some month and can't understand what is going on in the latest week (when the db grow a lot). The DB is around...
0
by: Scott Ribe | last post by:
I've got a problem which I think may be a bug in Postgres, but I wonder if I'm missing something. Two tables, A & B have foreign key relations to each other. A 3rd table C, inherits from A. A...
3
by: Prince Kumar | last post by:
Hi All, I am trying to a get a trigger retrieved from Oracle to work on DB2 UDB 8.1. I am getting the following error when trying to create the trigger. How would I resolve this? create table...
7
by: sql-db2-dba | last post by:
Does DB2 just fudge it when it is an empty table? Is there a "formula" for average row size when you have variable length records. Or you really have to know what your application is packing into...
4
by: dp | last post by:
After looking and looking, it appears that Access ADPs graphic query designer won't display: update customer set = . from customer, where customer. = .; It comes up with the "Query...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.