create tables and fields
Posted: Tue Dec 02, 2008 3:48 pm
I tried the below code to create tables and fields, not working I think according to the Google help have the syntax correct.
Anyone see what I'm doing wrong?
I get this error:
Anyone see what I'm doing wrong?
I get this error:
If I comment out after "echo connection made" I get the message that connection is made. I commented out line 20 and the error was moved down one line.Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/MyServer/public_html/MyFolder/CreateTables.php on line 20
Code: Select all
<?php
$hostname = "localhost";
$dbusername = "MyServer_MyUser";
$dbpassword = "**************";
$dbname = "MyServer_My_db";
$con1 = mysql_connect($hostname,$dbusername,$dbpassword);
if (!$con1)
{
die('Could not connect: ' . mysql_error());
}
echo "Connected made"
mysql_select_db($dbname, $con1); // Line 20
CREATE TABLE My_db
(
Level varchar(5) NOT NULL,
QN int(2) NOT NULL,
Question varchar(50) NOT NULL,
Answer varchar(50) NOT NULL,
Wrong1 varchar(50) NOT NULL,
Wrong2 varchar(50) NOT NULL,
Wrong3 varchar(50) NOT NULL,
HINT varchar(50) NOT NULL,
ImagePath1 varchar(50) NOT NULL,
ImagePath2 varchar(50) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
or die(mysql_error());
echo "Table Created!";
?>