Synergic Posted August 17, 2006 Share Posted August 17, 2006 As part of making my code more elegant and following an mvc pattern i want to store a query result inside a variable where i can invoke it else where besides the presentation layer.I've tried:[code]$result = mysql_fetch_array($quer);while($result) {}ends up being an endless loop. Do i need to continue to update the variable as i scroll through the rows?[/code] Quote Link to comment Share on other sites More sharing options...
shocker-z Posted August 17, 2006 Share Posted August 17, 2006 this is what you need[code]while ($result = mysql_fetch_array($quer)) {//code here}[/code]The way you were doing it ment that while $result exists do what ever is between the bracketsThe way i have shown above means that while $result can be get the next value from mysql_fetch_array($quer)regardsLiam Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.