ccrevcypsys Posted December 11, 2007 Share Posted December 11, 2007 connecting to my database. Every time i put the code in the page just turns blank. It doesnt make sence... Im hosting off of localhost at my office. heres my code $user ="root"; $pass =""; $db ="nnds"; $link = @mysql_connect ("localhost", $user, $pass ); if( !$link){ die("Couldn't Connect To MySQL: ".mysql_error() ); } print "<h2> Successfully connected to database \"$db\"<br /> \n"; $mysql_select_db( $db ) or die ( "Couldn't open $db: ".mysql_error() ); mysql_close( $link ); Quote Link to comment Share on other sites More sharing options...
revraz Posted December 11, 2007 Share Posted December 11, 2007 You are not picking a database to log into. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 11, 2007 Share Posted December 11, 2007 Blank pages are usually caused by fatal parse or fatal runtime errors. Check your web server log for errors or turn on full php error reporting in php.ini or a .htaccess file (turning on error reporting in your script will not show fatal parse errors because your script never runs.) Quote Link to comment Share on other sites More sharing options...
revraz Posted December 11, 2007 Share Posted December 11, 2007 Now your succes message is before you even connect to the DB. Quote Link to comment Share on other sites More sharing options...
ccrevcypsys Posted December 11, 2007 Author Share Posted December 11, 2007 i fixed it but now i have this code <?php $user ="root"; $pass ="dragon"; $db ="nnds"; $link = @mysql_connect ("localhost", $user ); if( !$link){ die("Couldn't Connect To MySQL: ".mysql_error() ); } mysql_select_db( $db ) or die ( "Couldn't open $db: ".mysql_error() ); print "<h2> Successfully connected to Server \"$db\"<br /> \n"; mysql_close( $link ); ?> and now i get this error Fatal error: Function name must be a string in C:\xampp\htdocs\nnds\admin\aztmoprtmphli1135388593938274\newEdit.php on line 9 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.