Jump to content

Create a table


george

Recommended Posts

What I have is

DROP TABLE IF EXISTS phpArrayFunctions;CREATE TABLE IF NOT EXISTS phpArrayFunctions (  'increment' int(11) NOT NULL AUTO_INCREMENT,  'Function_Name' varchar(30) NOT NULL,  'Description' varchar(250) default NULL,  'Constants_Used' TINYTEXT default NULL,  'Arguments' TINYTEXT default NULL,  'Return_Value' TINYTEXT default NULL,  'Brief_Example' TEXT default NULL,  'Detailed Example' LONGTEXT default NULL,  'Pass_Fail' boolean default false,  'Times_Pass' int(11) default 0,  PRIMARY KEY  ('Increment')) ENGINE=MyISAM DEFAULT CHARSET=latin1;

I can not find the error.

Link to comment
Share on other sites

Okay, I created the table using phpAdmin, and then tried to import one row of data. Error.

INSERT INTO 'phpArrayFunctions'('increment','Function_Name','Description','Constants_Used','Arguments','Return_Value','Brief_Example','Detailed Example','Times_Pass') VALUES (,'array_change_key_case','Changes all keys in an array',,,,,,);

I have tried several variations of this, using quotes, then using quotes for the null values. I always get an error. phpAdmin does give an error number. Is there somewhere that I can look up this error? The error discription is not helpful.

Link to comment
Share on other sites

You need to supply the error messages if you want help with specific errors. For the above, if you want those extra columns to be null values then either leave them out of the insert query or use NULL as the value. It is not valid to just have a list of commas.

Link to comment
Share on other sites

I did as you suggested, deleting my ``'s for blank values, and removing them altoghter

Error

SQL query:

INSERT INTO `phpArrayFunctions` ( `Function_Name` , `Description` )VALUES (`array_change_key_case` , `Changes all keys in an array`);

 

MySQL said: dot.gif

#1054 - Unknown column 'array_change_key_case' in 'field list'

Edited by george
Link to comment
Share on other sites

I don't like the fact that you seem to be using the left quote mark in the above text, and in fact I don't know if any quotes should be used on tablename or column names.

Edited by davej
Link to comment
Share on other sites

It's never a problem to use backquotes around identifiers like table and column names. In fact, they are required for certain names. Backquotes should be used for identifiers, and single quotes should be used for values. The error message says that array_change_key_case is an unknown column because you have it surrounded by backquotes, which are only used for identifiers (database, table, and column names).

 

INSERT INTO `phpArrayFunctions` ( `Function_Name` , `Description` )

VALUES ('array_change_key_case' , 'Changes all keys in an array');

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...