Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 6th, 2006, 02:20 AM
Registered User
 
Join Date: Apr 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default mysql help

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

 
Old April 6th, 2006, 04:31 AM
Authorized User
 
Join Date: Mar 2006
Location: , , India.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Why not MySQL ??? mysticav BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 1 August 18th, 2006 04:32 PM
MySQL 5.0 dparsons MySQL 0 May 11th, 2006 08:32 AM
mysql g.tamilselvan MySQL 1 February 22nd, 2006 10:45 AM
MYSQL hkurtulus BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 November 23rd, 2005 05:59 PM
MySQL 4.0 or 4.1 allang MySQL 1 January 10th, 2004 10:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.