Wrox Programmer Forums
|
All Other Wrox Books Do you have a question about a Wrox book that isn't listed anywhere on p2p.wrox.com or where the forum is locked? Here's a forum to post questions about any other Wrox book so that other readers or one of the authors can help you with your questions. IF YOU ARE LOOKING FOR CODE DO NOT ASK "Where can I find the code for this book?" That question is answered here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the All Other Wrox Books 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
  #1 (permalink)  
Old August 25th, 2011, 10:05 AM
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..
  #2 (permalink)  
Old August 25th, 2011, 10:40 AM
Registered User
 
Join Date: Dec 2009
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default

got the solution, i took off :8080 from localhost.

but the error now is

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'O, room_conditions TEXT NOT NULL, room_description TEXT NOT NULL, ' at line 5"

please help

thanks
  #3 (permalink)  
Old August 27th, 2011, 10:43 AM
Registered User
 
Join Date: Dec 2009
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I was able to sort out the syntax error.

Thanks

mel





Similar Threads
Thread Thread Starter Forum Replies Last Post
Lost connection query melkin MySQL 1 April 1st, 2008 09:09 AM
C# and mySQL Connection naifwonder C# 5 March 8th, 2008 01:52 PM
MySQL lost connection error melkin Classic ASP Basics 1 October 27th, 2007 06:37 AM
Saving data into Xml file when connection is lost kondapallichandu C# 2005 1 October 10th, 2007 07:25 AM
Mysql connection catab C# 4 December 7th, 2003 11:25 AM





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