php/mysql get_lock problem
- From: therflin <therflin@xxxxxxxxx>
- Date: Wed, 22 Jul 2009 06:44:35 -0700 (PDT)
Hi,
I'm implementing a locking mechanism with MySQL 5.0.36 and PHP 5.2.1
by means of the SQL statement
SELECT GET_LOCK ('lockname', timeout)
If I simply run the SQL statement from phpadmin (same user, same db)
and
it works providing the expected result (see http://i30.tinypic.com/10oqlhg.jpg)
but If I run it from php/mysql I'm getting the error 1146 - Table
'mysql.proc' doesn't exist.
Initially I went through the MySQL forums and docs and found that it
is a known problem in case of migrations from previous versions of
MySQL but then I tested through the phpadmin and in that case it
worked... which would mean to me that the mysql-db is properly
configured....
Any help is really appreciated.
Here is the sample code :
$db = mysql_connect($host,$user,$password) or die ("DB connection
error: ".mysql_error());
mysql_select_db($db_name, $db) or die ("DB selection errore:
".mysql_error());
function testit ($q) {
echo "Query: <b>" . $q . "</b><br>\n";
$r=mysql_query($q);
print "RESULT: " .$r ."<br>\n";
print "ERROR (" . mysql_errno() . "): " .mysql_error() ."<br><hr>\n";
}
testit ("SELECT * from events");
testit ("SELECT GET_LOCK ('events.test', 20)");
which outputs the following:
Query: SELECT * from events
RESULT: Resource id #4
ERROR (0):
Query: SELECT GET_LOCK ('events.test', 20)
RESULT:
ERROR (1146): Table 'mysql.proc' doesn't exist
.
- Follow-Ups:
- Re: php/mysql get_lock problem
- From: Jerry Stuckle
- Re: php/mysql get_lock problem
- From: C. (http://symcbean.blogspot.com/)
- Re: php/mysql get_lock problem
- Prev by Date: Re: I need help - Newbie stuck ( php check form input )
- Next by Date: www.beyondtheall.com cheaper nike shoes g-satr kidrobot hoodies ed hardy star red monkey gino green global true religion ed-hardy kidrobot jeans hoodies ***ier ***r exporters,manufacture
- Previous by thread: $_POST always empty
- Next by thread: Re: php/mysql get_lock problem
- Index(es):