At 10:46 AM 2/8/2006, suresh kumar wrote:
hai,
this is my sample code:
i am having user table with SponsorID as one
field in mysql database,this is my query;
for($j=0;$j<5;$j++):
$result=mysql_query("select * from user where SponsorID='$id[$j]' ");
endfor;
in above code when i print mysql_num_rows($result) inside for
loop its output is 5.when i print outside the for loop its o/p is 0.I
searched weberdev.com website and declared $result as global.but same
output 0.i want $result variable to be available outsibe the forloop
and all other part of my code.i am looking forward suggestions from ur side.
A.suresh
Did you read up on global vars and use of the "global" key word in functions?
Also check mysql_query() in the docs and what it returns. It's more of a
handle than anything else.
Finally, given you example you will have to use $result inside your loop.
Regards - Miles Thompson
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 267.15.2/253 - Release Date: 2/7/2006
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php