View unanswered posts | View active topics It is currently Sat Jun 25, 2022 9:52 am

Reply to topic  [ 2 posts ] 
 whats wrong with this code 
Author Message
Junior Member

Joined: Mon Apr 14, 2008 3:23 pm
Posts: 2
Location: Washington DC
Post Solved whats wrong with this code

// connect to database
$connect = mysql_connect ("localhost", "data_base", "anypass") or die ("lost")

//active data base
mysql_select_db ("data_bella") ;

//create "purchase invoice tablefood" called purchf
$purchf = "CREATE TABLE purchf (
auto_id bigint (200) NOT NULL auto_increment,
Invoice_num int(20) NOT NULL,
desc_prod varchar (255) NOT NULL,
date_purc date NOT NULL,
amm_pur int(20) NOT NULL,
primary key (auto_id),
)" ;

$results = mysql_query($purchf)
or die (mysql_error() ) ;

echo "done";

Mon Apr 14, 2008 3:27 pm
Report this post
Junior Member

Joined: Sat Dec 13, 2008 2:14 am
Posts: 1
I tried with the following way and got the success.........

@mysql_connect($host,$user,$pwd) or die("Connection Failed");
mysql_select_db($db) or die("Could not select database!!!!!");
echo "The MySQL database Connection Established!!!";
$query="CREATE TABLE author(
author_id INTEGER(4),
author_name VARCHAR(50),
author_degree VARCHAR(25),
speciality VARCHAR(35),
dob VARCHAR(15))";
if (@mysql_query($query))
Table Created successfully.");
else {
Error creating the table");


Sat Dec 13, 2008 2:26 am
Report this post
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
© Copyright 2003-2008 The ultimate PHP Editor and PHP IDE site.