By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,653 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

i'm going nuts

P: n/a
hi,

i'm new to php mysql and already have a problem with a simple routine

$result=mysql_db_query(jcorp,"select count(*) as bar from users");
$count = mysql_result($result,0,"bar"); //<<<<< this is line 3 in the
script
echo "Active Members $count";
this routine is working fine local coudn't be better

but when i put it on my site i get the following error

Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /home/virtual/site755/fst/var/www/html/active.php on line 3
what is wrong here???? i searched the web for different routines all work
localy but non work on the site they all give much the simelar error

please help me,
tnx


Jul 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I would guess your remote host has a setting somewhere that you're unaware
of.

A possibility: the name of the dB is prepended with something (sometimes
your user name?) -- so the full name is actually "lonewolf_jcorp" or
something. Are you able to make other queries successfully?

PS:
mysql_result($result,0,0)
will run a little faster, and obviate the "as bar" part

"The Lone Wolf" <jc*************@pandora.be> wrote in message
news:R4******************@afrodite.telenet-ops.be...
hi,

i'm new to php mysql and already have a problem with a simple routine

$result=mysql_db_query(jcorp,"select count(*) as bar from users");
$count = mysql_result($result,0,"bar"); //<<<<< this is line 3 in the
script
echo "Active Members $count";
this routine is working fine local coudn't be better

but when i put it on my site i get the following error

Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /home/virtual/site755/fst/var/www/html/active.php on line 3
what is wrong here???? i searched the web for different routines all work
localy but non work on the site they all give much the simelar error

please help me,
tnx

Jul 16 '05 #2

P: n/a
Try to isolate the problem:
1. connect to the db
$conn = mysql_connect(....);
2. select the database
$db = mysql_select_db(...);
3. fire your query
$res = mysql_query("select *...");

AND - check the return values, if something goes wrong, FALSE will
be returned and you should look into the mysql_error()!

HTH!
Rainer

The Lone Wolf schrieb:
hi,

i'm new to php mysql and already have a problem with a simple routine

$result=mysql_db_query(jcorp,"select count(*) as bar from users");
$count = mysql_result($result,0,"bar"); //<<<<< this is line 3 in the
script
echo "Active Members $count";
this routine is working fine local coudn't be better

but when i put it on my site i get the following error

Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /home/virtual/site755/fst/var/www/html/active.php on line 3
what is wrong here???? i searched the web for different routines all work
localy but non work on the site they all give much the simelar error

please help me,
tnx


Jul 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.