/    Sign up×
Community /Pin to ProfileBookmark

Array ("Notice: Undefined offset" error)

Hello all. I am getting error on line 6. The errors quantity is 800 (for each line of my db). For example:

Notice: Undefined offset: 1 on line 6
Notice: Undefined offset: 2 on line 6
Notice: Undefined offset: 3 on line 6
….. etc

  • 1. $result = mysql_query(“select * from sage_data”);

  • 2. $num = mysql_num_rows($result);

  • 3. $row = mysql_fetch_array($result);

  • 4. for ($i=0; $i<$num; $i++)

  • 5. {

  • 6. $show_all_res = $_POST[‘show_all_res’][$i];

  • 7. $result1 = mysql_query(“select * from sage_data where

  • 8. Module=’$show_all_res'”);

  • 9. while ($row1 = mysql_fetch_array($result1))

  • 10. {

  • 11. echo $show_all_res;

  • 12. }
  • The source page is:

    <form action=’show_all_res.php’ method=’post’>
    <select multiple id=”show_all_res” name=’show_all_res[]’>
    <?
    $result = mysql_query(“select * from `sage_data` GROUP BY Module”);
    while ($row = mysql_fetch_array($result))
    {
    if ($row[‘Module’]!=”)
    {
    echo “<option value=’$row[Module]’>”.$row[‘Module’].”</option>”;
    }
    }
    </select>
    </form>

    Please Please Please!!!!!! Tell me what to do?

    to post a comment
    PHP

    0Be the first to comment 😎

    ×

    Success!

    Help @harevik85 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.17,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...