Hi i have encountered one quirk in PHP, and I was wandering if anyone can explain it to me.
So writing this code gives me infinite loop
public static function find_this_query($sql){
global $Database;
$result_set = $Database->queryFunction($sql);
$theObjectArray = array();
$var = $result_set->fetch_assoc(); // I put the whole array in $var
while($row = $var){ // and then I put that here
// some code here
}
return $theObjectArray;
}
Buuuut this doesnt
public static function find_this_query($sql){
global $Database;
$result_set = $Database->queryFunction($sql);
$theObjectArray = array();
while($row = $result_set->fetch_assoc()){ // here I just put method and everything works fine
// some code here
}
return $theObjectArray;
}
So I just wanna know why.
Thanks nerdzzzz!