|
Posted by Hrvoje Vencl on 04/03/07 22:14
Hi,
got a bit stuck whit this... I have page where I connect to database
and it works fine, but when I try to do it in my own function, I get
error.
my code:
-----------------------------------------------
//connect to database...
$con = mysql_connect('localhost', 'root', '');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("pingdb", $con);
//example function
function modulePool(){
$sql = "SELECT tblPool.* FROM tblPool
ORDER BY tblPool.AddDate DESC
LIMIT 0, 1";
$result = mysql_query($sql) or die("Database Query Error<br>" .
mysql_error());
return $result ;
}
echo modulePool();
-----------------------------------------------
so here i get 'Access denied for user...' error. Please help.
[Back to original message]
|