Hello and welcome to our community! Is this your first visit?
Register
Results 1 to 2 of 2

Thread: MySQL help!

  1. #1
    Newbie desksinc's Avatar
    Join Date
    Oct 2010
    Location
    Hey, you have some nice furniture...
    Posts
    14

    MySQL help!

    I'm trying to create a table in MySQL using PHP, and I keep getting this error:

    Parse error: syntax error, unexpected T_STRING in /home/a2398192/public_html/forums/table-create-note.php on line 7

    Here is what my code looks like, excluding the first part where all my database info is.

    Code:
    CREATE TABLE phpbb_admin_notepad (  note_id mediumint(8) unsigned NOT NULL auto_increment,  note_subject varchar(100) character set utf8 collate utf8_bin NOT NULL,  note_message mediumtext character set utf8 collate utf8_bin NOT NULL,  note_poster_name varchar(255) character set utf8 collate utf8_bin NOT NULL,  note_poster_id mediumint(8) unsigned NOT NULL,  note_post_time int(11) unsigned NOT NULL,  note_bbcode_uid varchar(8) character set utf8 collate utf8_bin NOT NULL,  note_bbcode_bitfield varchar(255) character set utf8 collate utf8_bin NOT NULL,  note_edit_by varchar(255) character set utf8 collate utf8_bin NOT NULL default '0',  note_edit_by_id tinyint(8) unsigned NOT NULL default '0',  note_edit_time int(11) unsigned NOT NULL default '0',  note_is_private tinyint(1) NOT NULL default '0',  PRIMARY KEY  (note_id),  KEY poster_id (note_poster_id)) CHARACTER SET utf8 COLLATE utf8_binor die(mysql_error());  echo "Table Created!";?>
    Can someone please help me? (Excluding flamers, this forum has a lot!)

    EDIT: Whoops, forgot the MySQL Query part of the code...

    EDIT AGAIN: Crap, now I'm getting some other error...

    Parse error: syntax error, unexpected T_STRING in /home/a2398192/public_html/forums/table-create-note.php on line 25

    Code:
    // Create a MySQL table in the selected databasemysql_query("CREATE TABLE phpbb_admin_notepad(  note_id mediumint(8) unsigned NOT NULL auto_increment,  note_subject varchar(100) character set utf8 collate utf8_bin NOT NULL,  note_message mediumtext character set utf8 collate utf8_bin NOT NULL,  note_poster_name varchar(255) character set utf8 collate utf8_bin NOT NULL,  note_poster_id mediumint(8) unsigned NOT NULL,  note_post_time int(11) unsigned NOT NULL,  note_bbcode_uid varchar(8) character set utf8 collate utf8_bin NOT NULL,  note_bbcode_bitfield varchar(255) character set utf8 collate utf8_bin NOT NULL,  note_edit_by varchar(255) character set utf8 collate utf8_bin NOT NULL default '0',  note_edit_by_id tinyint(8) unsigned NOT NULL default '0',  note_edit_time int(11) unsigned NOT NULL default '0',  note_is_private tinyint(1) NOT NULL default '0',  PRIMARY KEY  (note_id),  KEY poster_id (note_poster_id)) CHARACTER SET utf8 COLLATE utf8_binor die(mysql_error());  echo "Table Created!";?>
    [center:12wo0y3y]

    The reason why I don't come on that often?

    Quote Originally Posted by Flamer
    You're an idiot Driv3r!
    Quote Originally Posted by Some Other Troll
    YOU'RE AN IDIOT! YOU DON'T KNOW SUCH AND SUCH BLAH BLAH BLAH!
    Seriously, get it together DarkDemon. What's the point of mods if everyone acts like idiots anyway?[/center:12wo0y3y]

  2. #2
    Obsessed Veteran Adam's Avatar



    Join Date
    Nov 2004
    Location
    UK / England
    Posts
    17,271

    Re: MySQL help!

    You've only posted part of your code... it doesn't really help.

    Additionally why are you creating tables via PHP? Creating a new table via PHP is something that rarely needs to be done. You should be pre-creating the tables in phpMyAdmin or some other database management tool, then inserting and updating a table not creating new ones, unless you have a good reason to do it this way?

    As the error suggests you have a syntax area on or around line 25.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •