Don't get connection using ezSQL
Hello,
I desperatly wants to use ezSQL, but it's not working, can someone tell me what I do wrong?
Normaly I don't need to fill in the db_user and db_password at localhost to get a connection with MySQL and my database. With ezSQL I always get the following warning:
Warning: Require $dbuser and $dbpassword to connect to a database server in mysql/ez_sql_mysql.php on line 78
In the old-fashoned way, it's working perfectly well, so what is the problem???
Has it to do with my version of PHP3 or MySQL???
Thanks for helping,
CactusDev
PHP-content:
see following page
// **** ezSQL ****
// ** script using ezSQL
// **
// Include ezSQL
include_once "shared/ez_sql_core.php";
include_once "mysql/ez_sql_mysql.php";
// Connection to MySQL and database ('db_user','db_password','db_name','db_host')
$db = new ezSQL_mysql('','','test','localhost');
// Run Query using ezSQL
echo "Running Query using ezSQL:";
if($query = $db->get_results("SELECT * FROM friends", ARRAY_A));
{
foreach ($result as $query)
{
echo "$result->Name ";
}
}
else {echo "no results ";}
// **** normal PHP-MySQL script ****
// ** Old fashoned way...
// **
// Connection to MySQL and database
$db = mysql_pconnect('localhost','','');
if (!$db)
{
die("Oops, my fault something went totally wrong...");
}
mysql_select_db('test',$db);
// Run Query using the old-fashoned way
echo "Running Query using the old-fashoned way: ";
$query = "SELECT * FROM friends";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result))
{
echo $row['Name']. "";
}
