Can someone please tell me what's wrong with the following code?  This info
is inside a function that I defined.  One of the arguments that I pass the
function is the actual query.  Based on the info that I know is loaded in
the database (it's a development database...there are only 2 rows of info),
the query I define only returns two answers.  In case you're wondering...the
query works fine from within mysql, no problems there.  The problem seems to
lie in the loop construct.  It displays the first record fine.  But the
second record comes up as an invalid index reference.  Someone help...  How
do you all display your results?  I know there is another while() that I've
seen used, but I can't remember the syntax.  And I'm new to this by the
way...


  $result = mysql_query($query);
  $num_results = mysql_num_rows($result);
   
   if($num_results)
    {
         echo "I have located ".$num_results." results that match the
information you provided.";
    }
 
   $i = 0; 
   while($num_results > $i)
    {
      $row = mysql_fetch_row($result);
      echo "<p>" . ($i + 1) . "Display the queried info: ";
      echo htmlspecialchars( stripslashes($row["$i"]));
      echo "</p>";
      $i++;
    }



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to