Avatar of breeze351
breeze351

asked on 

Fatal error: Call to a member function fetch_array() on a non-object

Why would the following code produce the above error the 3rd itteration?

while ($row_comp = $comp->fetch_array())
{
      $comp_count++;
      $comp_id = $row_comp['TID'];            
      $SqlString = "select * from pers where TID = \"$comp_id\"";
      echo "str = ".$SqlString."<br>";
      $pers = $conn->query($SqlString);
      while ($row_pers = $pers->fetch_array())
      {

The screen output looks like this:
str = select * from pers where TID = "10019706"
str = select * from pers where TID = "10019771"
str = select * from pers where TID = "10019779"

Fatal error: Call to a member function fetch_array() on a non-object in /home/langsyst/public_html/Lansco/Fix_Data_2A.php on line 58

Line 58 is the 2nd while
PHP

Avatar of undefined
Last Comment
breeze351

8/22/2022 - Mon