Accessing MySql in PHP on Yahoo! Web hosting

Hi,

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

<html>

<center>
<h1>My website title</h1><br>
<?php
$dbhost = 'localhost';
$dbuser = 'admin';
$dbpass = 'mypassword';

echo '<p>PHP works!</p>';

$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';
}
?>
</center>
</html>

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
SWMason03 [ Do, 07 Dezember 2006 05:53 ] [ ID #1560554 ]

Re: Accessing MySql in PHP on Yahoo! Web hosting

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
Sean [ Do, 07 Dezember 2006 11:14 ] [ ID #1560558 ]
PHP » alt.php.sql » Accessing MySql in PHP on Yahoo! Web hosting

Vorheriges Thema: not able to retrieve numeric entries
Nächstes Thema: using fields from two tables - mysql