mysql_connect and private user function

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.
Hrvoje Vencl [ Mi, 04 April 2007 00:14 ] [ ID #1677572 ]
PHP » alt.php.sql » mysql_connect and private user function

Vorheriges Thema: Is there an editor/tool to generate code from MySQL
Nächstes Thema: Is This Possible?