View Single Post
  #1 (permalink)  
Old August 25th, 2011, 10:05 AM
igtoroy igtoroy is offline
Registered User
 
Join Date: Dec 2009
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default Lost connection to MySQL server

Hi,

I got the following error when i was attempting to create a database:

PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Lost connection to MySQL server at 'reading initial communication packet', system error: 0 in C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2\\htdocs\\bookingdb.php on line 3

PHP Fatal error: Maximum execution time of 30 seconds exceeded in C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2\\htdocs\\bookingdb.php on line 3


this is the line 3 command:
Code:
$db = mysql_connect('localhost:8080', 'bp6am', 'bp6ampass') or
die ('Unable to connect, check your connection parameters.');
what seems to be the problem? SOS please
thank you very much!

BTW this is the whole codes:
Code:
<?php
//connect to MySQL
$db = mysql_connect('localhost:8080', 'bp6am', 'bp6ampass') or
die ('Unable to connect, check your connection parameters.');

//create the main database if it doesn't already exist
$query = 'CREATE DATABASE IF NOT EXISTS booking';
mysql_query($query, $db) or die(mysql_error($db));

//make sure our recently created database is the active one
mysql_select_db('booking', $db) or die(mysql_error($db));

//create the room table
$query = 'CREATE TABLE room 
	(
	room_id			INTEGER UNSIGNED  NOT NULL 	AUTO_INCREMENT,
	room_name		VARCHAR(255)	  NOT NULL,
	daily_room_rate		DECIMAL(6,2)	  NOT NULL	DEFAULT O, 
	room_conditions		TEXT		  NOT NULL,
	room_description	TEXT		  NOT NULL,
	max_capacity		TINYINT		  NOT NULL	DEFAULT O,
	PRIMARY KEY (room_id)
	)
	ENGINE=MyISAM';
mysql_query($query, $db) or die(mysql_error($db));

//create the roomtype table
$query = 'CREATE TABLE roomtype
	(
	roomtype_id		INTEGER UNSIGNED  NOT NULL	AUTO_INCREMENT,		
	room_facilities		TEXT		  NOT NULL,
	room_size		TEXT		  NOT NULL,
	bed_size		TEXT		  NOT NULL,
	PRIMARY KEY (roomtype_id)
	)
	ENGINE=MyISAM';
mysql_query($query, $db) or die(mysql_error($db));
	
//create the cutomer table
$query = 'CREATE TABLE customer
	(
	customer_id		INTEGER UNSIGNED	NOT NULL	AUTO_INCREMENT,
	customer_lname		VARCHAR(225)		NOT NULL,
	customer_fname		VARCHAR(225)		NOT NULL,
	add_num			VARCHAR(225)		NOT NULL,		
	add_townc		VARCHAR(225)		NOT NULL,		
	add_zip			VARCHAR(225)		NOT NULL,
	add_coun		VARCHAR(225)		NOT NULL,
	tel			INTEGER UNSIGNED	NOT NULL,		
	mobile			INTEGER UNSIGNED	NOT NULL,
	email			VARCHAR(225)		NOT NULL,
	PRIMARY KEY(customer_id)
	)
	ENGINE=MyISAM';
mysql_query ($query, $db) or die(mysql_error($db));

echo 'Booking database successfully created';
?>

Last edited by igtoroy; August 25th, 2011 at 10:20 AM..