In my attempts to learn more about php and mysql, I have been trying to use a php page to create a new table in a database. I have seen a number of online tutorials but, for some reason, cannot get it to work for me.
I keep getting an error regarding an unexpected T_string on line 16, which reads:
"DROP TABLE IF EXISTS 'panLogin';" (without the double quotes)
I have read that this is usually indicative of an unclosed bracket or something similar, but I just can't seem to find it.
the code is:
[/code]
$db_host = "localhost";
$db_user = "root";
$db_pass = "";
$db_name = "mydatbasename";
$connection = mysql_connect($db_host,$db_user,$db_pass);
If (!(mysql_select_db ($db_name,$connection))) {
echo "Could not connect to the database";
}
DROP TABLE IF EXISTS 'panLogin';
CREATE TABLE 'panLogin' (
'panid' tinyint(3) NOT NULL auto_increment,
'username' varchar(32) default NULL,
'password' varchar(32) default NULL,
PRIMARY KEY ('panid')
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO 'panLogin' VALUES (1,'username','password');
DROP TABLE IF EXISTS 'panreg';
CREATE TABLE 'panreg' (
'regId' smallint(3) NOT NULL auto_increment,
'firstName' text,
'lastName' text,
'zone' text,
'org' text,
'pobox' text,
'postal' text,
'city' text,
'province' text,
'phone' text,
'fax' text,
'email' text,
'arrive22' text,
'arrive23' text,
'iocTour' text,
'infoTour' text,
'meetgreet' text,
'satDinner' text,
'steak' text,
'chicken' text,
'vegetarian' text,
'specRec' text,
'conName' text,
'conNum' text,
PRIMARY KEY ('regId')
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
[/code]
I hope I used those
tags correctly for posting the code here in the forum. As you can surely guess, I am still a newbie when it comes to this.