Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

mysql_connect and private user function

 
   Database Help (Home) -> PHP SQL RSS
Next:  NULL fields in table - efficiency question  
Author Message
Hrvoje Vencl

External


Since: Apr 03, 2007
Posts: 1



(Msg. 1) Posted: Tue Apr 03, 2007 3:14 pm
Post subject: mysql_connect and private user function
Archived from groups: alt>php>sql (more info?)

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.

 >> Stay informed about: mysql_connect and private user function 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
SQL needs AGE function. - Hello, I want to select people from a database within a certain age range. For example: Select * From TablePerson Where (Age(Birthdate) > 20) and (Age(Birthdate) < 98) That would make it really easy. Things I have tried so far: Trail 1, SQL....

function problem involving query - I'm trying to construct a database of old houses including the parts they are made of as roof construction, floor construction, types of windows, vaults, etc. To do that I set up several tables. One containing the house id, address, last visit, etc. For....

PHPtriad v2.2.1 removal - When I fist started using apache/php/mysql I used phptriad [a wonderful piece of kit] to get me up and running. I've used this ever since. I'm think inow of 'upgrading' to laters versions of all three applications, and have found various tutorials/Ho...

MySQL regular expression to match a imploded item - Hello I need to use MySQL's REGEXP (POSIX compliant) to search registries where one field is an imploded set of integer values separated with pipes "|". I need to match one of these imploded values directly on a sql select. $sql = "SELECT...

Weird mysql_connect problem - Hello. My mysql_connect just started to give me following error today, Fatal error: Call to undefined function: mysql_connect() in ..../database_functions/db_functions.inc.php on line 11. So it seems that my php no longer finds php-mysql module...
   Database Help (Home) -> PHP SQL All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]