Accessing MySql in PHP on Yahoo! Web hosting

Accessing MySql in PHP on Yahoo! Web hosting

am 07.12.2006 05:53:15 von SWMason03

Hi,

As anyone successfuly used mysql in yahoo? I'm having trouble
connecting here's my code:




My website title



$dbhost = 'localhost';
$dbuser = 'admin';
$dbpass = 'mypassword';

echo '

PHP works!

';

$db = new mysqli($dbhost,$dbuser,$dbpass,'mysql');

echo 'Gets here!'; //never gets here?

if (mysqli_connect_errno())
{
echo 'Error connecting to DB!';
}else{
echo 'DB connection good';
}
?>



Shouldn't I at least get an error message? Yahoo claims it makes a
database called "mysql" for you. I'm not sure what parameters I should
enter or why I'm not getting a good error message.

Thanks,
Steve

Re: Accessing MySql in PHP on Yahoo! Web hosting

am 07.12.2006 11:14:22 von Sean

Change a line of code, as follows:

> $db = new mysqli($dbhost,$dbuser,$dbpass,'mysql') or die
> ('Error'.\mysql_error());

Now you should get the error message.

Sean