View unanswered posts | View active topics It is currently Wed May 25, 2022 3:10 pm



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
<html>
<body>
<?php

// 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";
?>
</body>
</html>


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

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


<?php
$user='user1';
$pwd='password';
$db='db1';
$host='localhost';
@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))
{
echo("
Table Created successfully.");
}
else {
echo("
Error creating the table");
}
?>


Thanks
Rony


Sat Dec 13, 2008 2:26 am
Report this post
Profile
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:  
cron
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.