php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38230 page doesn't load with mysql connect
Submitted: 2006-07-27 05:14 UTC Modified: 2006-07-28 16:47 UTC
From: tianlianna at yahoo dot com dot sg Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.1.4 OS: Mac OS X 10.4.7
Private report: No CVE-ID: None
 [2006-07-27 05:14 UTC] tianlianna at yahoo dot com dot sg
Description:
------------
PHP and MySQL both works fine individually. but when i try to use mysql connect in php and save the code, the page doesn't load. it shows that it's trying to connect to localhost but it doesn't load eventually. the explorer just shows done with nothing being loaded. if i have a previous page on the explorer it will still be there and refresh will refresh that page. there are no error messages. someone please help me. 

Reproduce code:
---------------
<?php 
	$dbhost = 'localhost';
	$dbuser = 'user';
	$dbpass = 'password';
	
	$conn = mysql_connect($dbhost, $dbuser, $dbpass)
if($conn)
{        echo $conn;}else{
        die('Error connecting to mysql');}
	
	$dbname = 'test';
	mysql_select_db($dbname);
?>

Expected result:
----------------
either '1' or 'error connecting to mysql'

Actual result:
--------------
the page loads for a while but eventually doesn't load the page and shows a blank page but the status bar of the explorer indicates that the page is loaded or "done"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-27 06:26 UTC] tony2001@php.net
Turn on the error messages.
error_reporting(E_ALL);
and display_errors = On 
 [2006-07-28 12:03 UTC] tianlianna at yahoo dot com dot sg
added those two lines in front of the code.

error_reporting(E_ALL);
display_errors == On;

still the same result. the explorer will say waiting for localhost and then done without anything being loaded on the page.
 [2006-07-28 16:47 UTC] bjori@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

There is a syntax error in your script.
Edit your php.ini to show errors and restart your 
webserver.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 19 06:00:03 2025 UTC