MySQL and PHP Microsoft Windows Error - Any idea what's happening?
I'm running the follo开发者_如何学编程wing code:
<?php
$dbc = mysql_connect('myforeignserver.wisc.edu:3306','mydb','mypassword');
echo "This Works";
?>
Instead of generating a this works, like it should, I get a windows bar which pops up and says Apache HTTP Server stopped working and was closed. I really have no idea what the issue is. Please help! thank you!
The arguments that mysql_connect take are (php.net/mysql_connect):
resource mysql_connect ([ string $server = ini_get("mysql.default_host") [, string $username = ini_get("mysql.default_user") [, string $password = ini_get("mysql.default_password") [, bool $new_link = false [, int $client_flags = 0 ]]]]] )
Basically:
$con = mysql_connect("myforeignserver.wisc.edu:3306",$username,$pass);
if($con)
{
echo "Successfull connection!";
}
else
{
echo "Connection Failed!";
}
mysql_select_db("mydb",$con);
Hopefully that should set you going the right direction :o)
You may also want to take a look at this w3schools tutorial
The "This application has crashed" popups in Windows usually have a "more details" button that'll give you some extra information about the crash, particularly which exe/dll the crash occured in. If that's not available, then the crash should have been recorded in the system logs, which you can get at with eventvwr
, usually under "Windows Logs -> Application".
Without any more details about the crash, that's about all you'll get for help from here. There's just not enough information and far too many possibilities. Firewall, bad dll, corrupted exe, blah blah blah...
精彩评论