Subject: mysql help
Posted By: benzspida Post Date: 4/6/2006 2:20:41 AM
ust started learning php mysql dont know if i am doing this right

trying to create a database with 4 columns

this is what i have so far

<html>
<head>
<title>
mysql databser
</title>
</head>
<body>
<? php

$new_db = "testDB2";

$connection = mysql_connect("localhost", "craig", "1978");
if (!$connection)
{
die("Could not connect to the server");
}

$result = mysql_create_db($new_db, $connection);

if ($result)
{
$msg = "Congrats! Your database has been created!";
}
else
{
die("Could not create a new database");
}

?>

<p><?php echo $msg; ?></p>
</body>
</html>


mysql>creat database testDB2;

mysql>use testDB2;

mysql>create table table_name (

column_1_name column_1_type column_1_details,
column_2_name column_2_type column_2_details,
column_3_name column_3_type column_3_details,
column_4_name column_4_type column_4_details,
...
);

mysql>create table dbmyrestaurant (

Itemid int not null auto_increment primary key,

);



can any one help me please

thanks
Edit/Delete Message

Reply By: milind.paralkar Reply Date: 4/6/2006 4:31:09 AM
if this is the same script you are running & pasted here...
then there are two errors
1) after body tag, the php tag is written properly
<body>
<? php
It should be
<body>
<?php

Another thing,
In mysql create table statement you have given comma , and no other column you are providing after it. Remove comma it will work.

Regards
Milind


Go to topic 42510

Return to index page 322
Return to index page 321
Return to index page 320
Return to index page 319
Return to index page 318
Return to index page 317
Return to index page 316
Return to index page 315
Return to index page 314
Return to index page 313