Nim199 Posted October 31, 2007 Share Posted October 31, 2007 Hi, I am trying to Create the tables for a Forum.Here is my code, can you please tell me what is wrong with it. <?php$con = mysql_connect("######","######","######");mysql_select_db("######",$con);$CMembers = "CREATE TABLE members(UserID integer(6),UserName varchar(50),UserPassword varchar(20),Posts integer(6),BirthDate date(yyyymmdd),Statement varchar(200))";mysql_query($CMembers,$con);mysql_close($con);?> $con is correct, and I have create the database, it exist, and the true name is correct.Note: SHARP (#) signs act as wild card(s). I have put them in for security. The number of '#' does not correspond with the number of charactors. Link to comment Share on other sites More sharing options...
murfitUK Posted October 31, 2007 Share Posted October 31, 2007 I don't think INTEGER is a valid type. You can use things like INT, TINYINT, SMALLINT, MEDIUMINT and BIGINT, or NUMBER(3) for 3-digit numbers, FLOAT, DOUBLE and DECIMAL etc. Link to comment Share on other sites More sharing options...
Nim199 Posted October 31, 2007 Author Share Posted October 31, 2007 I don't think so. I have used 'Integer' before without any problems, but I will try with INT when I can next. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 31, 2007 Share Posted October 31, 2007 If it doesn't work then you need to print the error message from MySQL to figure out what the problem is, that's a lot easier then guessing. The mysql_error function will return the last error message. Link to comment Share on other sites More sharing options...
Synook Posted October 31, 2007 Share Posted October 31, 2007 On MySQL the engine does not accept the yyyymmdd argument for the date field type - there is only one type of "date" in MySQL, in the format YYY-MM-DD. That cannot be changed.There is a list of MySQL field types here - http://www.xnote.com/howto/mysql_field_types.htmlINTEGER is a valid alias of INT. Link to comment Share on other sites More sharing options...
Nim199 Posted October 31, 2007 Author Share Posted October 31, 2007 No error meassag returned. Just a blank screen. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 31, 2007 Share Posted October 31, 2007 If there's no error message from mysql_error then the query worked. Otherwise there would be an error. Link to comment Share on other sites More sharing options...
Synook Posted November 1, 2007 Share Posted November 1, 2007 You have to type echo mysql_error(); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.