• Error on line 3 Please Help.
    7 replies, posted
  • I know this seems to be an issue but I can not seem to figure it out, I've spent hours looking at the same line of code and getting nothing, please help. [code] Warning: mysql_connect() [function.mysql-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\db_ch03-1.php on line 3 Warning: mysql_connect() [function.mysql-connect]: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\db_ch03-1.php on line 3 Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\db_ch03-1.php on line 3[/code] and this is the code [code]<?php //connect to MySQL $db = mysql_connect( 'localhost', '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 moviesite'; mysql_query($query, $db) or die(mysql_error($db)); //make sure our recently created database is the active one mysql_select_db('moviesite', $db) or die(mysql_error($db));[/code]
  • I do have the service running, I also created the user using MySQL Administrator as well as tried [code]$db = mysql_connect( 'localhost:3306', 'bp6am', 'bp6ampass') or die ('Unable to connect. Check your connection parameters.'); [/code]
  • It's not your PHP, although on the die it should echo the mysql_error(), (not getting called anyway) it's the SQL, make sure your firewall for some reason isn't blocking local connections, and blah blah blah make sure the SQL is actually -snipping- (Duhrr don't mind me not reading responses). (Check with PHPMyAdmin?)
  • It is pretty simple, it can't connect to the database. Could be things like firewall or such.