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] Link to comment https://forums.phpfreaks.com/topic/17821-how-do-i-store-mysql_fetch_arrayquery-into-a-variable/ 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 Link to comment https://forums.phpfreaks.com/topic/17821-how-do-i-store-mysql_fetch_arrayquery-into-a-variable/#findComment-76101 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.