Jump to content

[SOLVED] I am having a hard time


ccrevcypsys

Recommended Posts

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 );

Link to comment
https://forums.phpfreaks.com/topic/81215-solved-i-am-having-a-hard-time/
Share on other sites

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.)

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.