SQL Tables
date posted 10th September 2002 22:56
This is a multi-part message in MIME format.
------=_NextPart_000_0009_01C2591C.B35C6B50
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Hi if you have a look at this script, below the first $query I have
another but as a comment. What I would like to know is how can I add
that comment to the php script so it also creates that table, as I have
tried all I can.
include("vars.php");
//Create the MySQL Database.
$result = mysql_create_db ("$db_name");
if ($result == false)
echo mysql_errno() . ": " . mysql_error() . "";
//Connect To The New Database
$connection = mysql_connect ("localhost", "darren", "pass");
if ($connection == false){
echo mysql_errno().": ".mysql_error()."";
exit;
}
//Create The User Table
$query = "create table users " ."(id INT NOT NULL AUTO_INCREMENT,
username varchar(50), password varchar(50), name varchar(50), email
varchar(50), type varchar(10), PRIMARY KEY (id))";
//$query = "create table properties " ."(id INT NOT NULL AUTO_INCREMENT,
thumbnail varchar(50), location varchar(50), price varchar(10), address
varchar(100), img1 varchar(50), img2 varchar(50), img3 varchar(50), img4
varchar(50), info varchar(5000), PRIMARY KEY (id))";
$result = mysql_select_db("$db_name"); mysql_query("$query");
if ($result)
echo "The users table was successfully created!";
else
echo mysql_errno().": ".mysql_error()."";
mysql_close ();
------=_NextPart_000_0009_01C2591C.B35C6B50
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi if you have a look at this script, below the first =
$query
I have another but as a comment.
What I would like to know is how can I =
add that
comment to the php script so it also creates =
that
table, as I have tried all I can.
include("vars.php");
//Create the MySQL =
Database.
$result =3D mysql_create_db ("$db_name");
if =
($result =3D=3D false)
 =
; echo mysql_errno() . =
":
" . mysql_error() . =
"<BR>";
//Connect To The New =
Database
$connection =3D mysql_connect
("localhost", "darren",
"pass");
if =
($connection =3D=3D
false){
echo mysql_errno().": ".mysql_error()."<BR>";
exit;
} =
//Create The User Table
$query =3D "create table users "
."(id INT NOT NULL AUTO_INCREMENT, =
username varchar(50), password varchar(50),
name varchar(50), email varchar(50),
type varchar(10), PRIMARY KEY (id))"; =
//$query =3D "create table properties
" ."(id INT NOT NULL AUTO_INCREMENT, thumbnail varchar(50), location varchar(50),
price varchar(10), address varchar(100),
img1 varchar(50), img2 varchar(50),
img3 varchar(50), img4 varchar(50),
info varchar(5000), PRIMARY KEY (id))"; =
$result =3D mysql_select_db("$db_name"); =
mysql_query("$query");
if =
($result)
echo "The users table was successfully =
created!";
else
echo mysql_errno().": ".mysql_error()."<BR>";
mysql_close =
();
------=_NextPart_000_0009_01C2591C.B35C6B50--