FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Not bale to connect to MySQL with PHP
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Not bale to connect to MySQL with PHP [message #169652 is a reply to message #169651] Tue, 21 September 2010 18:14 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 9/21/2010 12:40 PM, MikeB wrote:
> Denis McMahon wrote:
>> On 21/09/10 15:47, MikeB wrote:
>>
>>> I tried it and it seems to connect to something. I get this:
>>>
>>> telnet localhost 3306 and then:
>>>
>>>> B
>>>> 5.1.49-community-lo6IJyD%*☻L9wl8qR&cA[(
>>>
>>> and a few seconds later I get:
>>>
>>>> Connection to host lost.
>>>>
>>>> C:\Users\Mike>
>>
>> OK, that's almost what happens on my working system, except that I don't
>> see any text from the mysql connection.
>>
>> However, I overlooked this:
>>
>>> <?php
>>> Echo "Hello";
>>> require_once 'login.php';
>>> echo "got require";
>>
>> You didn't say whether any of these echoes were sent to the browser?
>
>
> The echos only get sent to the browser when I //-comment out the
> mysql_connect statement.
>
>>
>> Also, as you're in the document body, it's a good idea to wrap those
>> echoes in suitable html element tags, eg:
>>
>> <?php
>> Echo "<p>Hello</p>";
>> require_once 'login.php';
>> echo "<p>got require</p>";
>>
>> and see what happens if you comment out the database stuff:
>
> See above, 'cept I just let the debugging stuff run on to one line.
>
>>
>> /*
>> $db_server = mysql_connect($db_hostname, $db_username, $db_password);
>> if (!$db_server)
>> die("Unable to connect to MySQL: " . mysql_error());
>> echo "Congrats, it seems you have connected to the server<br />
>> host: $db_hostname<br />
>> user: $db_username<br />
>> password: $db_password<br />
>> for database: $db_database<br />";
>> print_r($db_server);
>> */
>>
>> ?>
>>
>> Just to check the underlying php / html functionality.
>>
>> You could also add the following after 'echo "<p>got require</p>";'
>>
>> echo "<p>db info: user = '$db_username', host = '$db_hostname', pw =
>> '$db_password'</p>";
>
> Did this also. I get the values in the login.php file. But again, only
> if I comment out the mysql_connect statement. If I don't, it just hangs
> the entire browser window indefinitely. I just copied the "success" echo
> block of the code to before the mysqlL-connect statement.
>
> I'm just plumb out of ideas.
>
> I'm gonna try install a different WAMP package on another computer and
> see if I get any further. :(
>

What happens if you use '127.0.0.1' instead of 'localhost'?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Php Include bug in firefox
Next Topic: Feed RSS and accented and other special chars
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 29 08:25:20 GMT 2024

Total time taken to generate the page: 0.04788 seconds