Reply to mysql_connect and private user function

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация