Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    2

    Unanswered: Execution quits after while ($row = mysql_fetch_assoc($result))

    After this PHP routine executes, the code that follows doesn't execute.

    Here is the code that works:

    <?PHP //create upline mentors
    include("link.inc"); //connection links
    $connection = mysql_connect($hostname,$username, $password)
    or die ("Couldn't connect to server.");

    $db = mysql_select_db($dbname, $connection)
    or die ("Couldn't select database.") ;
    while ($mentor != 61)
    {
    $sql="SELECT JAPNumber, First, Last, Email, MatrixSponsor FROM JAPeople WHERE JAPnumber = '$mentor'";
    $result=mysql_query($sql);
    if(!$result)
    {
    die(mysql_error());
    }
    $num = mysql_num_rows($result);
    if($num > 0) //this mentor exists
    {
    while ($row = mysql_fetch_assoc($result)) // this Subscriber can be loggedin
    {
    $First= $row['First'];
    $Last= $row['Last'];
    $mentor = $row['MatrixSponsor'];
    $Email = $row['Email'];
    $mentorarray[$arynum] = $First." ".$Last." - Email: ".$Email;
    echo "<p><font color='Yellow' size='4'>";
    $arynum1 = $arynum+1;
    echo "Mentor No. ".$arynum1." - ".$mentorarray[$arynum];
    echo "</font></p>";
    $arynum = $arynum + 1;
    }
    }
    else
    {
    if ($mentor != 0)
    {
    echo "<font color='Yellow' size='4'>";
    echo "No record found for upline "."Mentor=".$mentor;
    echo "</font>";
    exit;
    }
    }
    }
    ?>

    This code immediately follows the above and doesn't execute:

    <?php
    echo "<p><font color='#00FF00' size='4'>";
    echo "MY TEAM:";
    echo "</font></p>";
    ?>

    I would appreciate and suggestions as to why it doesn't work.

    Thanks,

    Peter

  2. #2
    Join Date
    Mar 2007
    Location
    636f6d7075746572
    Posts
    770
    Please use [ code ] tags to put your code in so that it is more readable for anyone assisting you.

    What error are you getting? Are you getting any output at all?
    use the following at the top of your script:
    Code:
    <?php
    error_reporting(E_ALL|E_STRICT);
    ?>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •