OFB Community Mailing Lists

The following archives are provided as a public service to the community. Opinions archived here do not necessarily represent the opinions of Open for Business or its contributors.

[CS-FSLUG] Why one but not the other (SQL query)

Frank Bax fbax at sympatico.ca
Sat Dec 27 13:05:24 CST 2008


David McGlone wrote:
> $query = "SELECT * FROM subheaderText";
> $result= mysql_query($query);
> $num = mysql_fetch_array($result);
> $num=0;
> while ($num < $result){
> echo "$subheaderTextID<br>"; 
> $num++;
> echo $num;
> }
> this query echo's back: 12345.
> 
> In the above code, I believe that $result should contain all 6 rows


$result does not contain all 6 rows; $result is a "resource"; an object 
you can send to other mysql functions (like mysql_fetch_array); but it 
has no meaning within php itself.

If you insert/remove a call to any mysql function before the above code; 
you will get different results from this loop.





More information about the Christiansource mailing list
Home About Connect: Twitter Facebook RSS
© 2001-2011 Universal Networks, All Rights Reserved. Some content rights may be held by Universal Networks' providers and used under license. Powered by ServerForest and SAFARI. Learn about our privacy policy here.