// This block grabs the whole list for viewing
$my_id = isset($_POST['id']) ? $_POST['id'] : '';

$ped_list = "";
$sql = "SELECT * FROM `pedagogu`";
$result2 = @mysql_query($sql) or die($sql."<br/><br/>".mysql_error());
$pedCount = mysql_num_rows($result2); // count the output amount
if ($pedCount > 0) {
    while($row = mysql_fetch_array($result2)){ 
             $my_id = $row["ID_Pedagog"];
             $ped_emri = $row["Emri"];
             $ped_mbiemri = $row["Mbiemri"];
             $date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
             $ped_list .= "Ped ID: $id - <strong>$ped_emri</strong> -<strong>$ped_mbiemri</strong>  - <em>Added $date_added</em>       <a href='inventory_edit.php?pid=$id'>edit</a> • <a href='pedagog_list.php?deleteid=$id'>delete</a><br />";
} else {
    $ped_list = "Nuk ka pedagoge te shtuar ne databaze";

Notice: Undefined index: ID_Pedagog , date_added, id

5 Years
Discussion Span
Last Post by broj1

can you help me solve this ? when i run it on my localhost gives me error **Notice:Undefined index:ID_Pedagog ** **Notice:Undefined index:date_added ** **Notice:Undefined index:id **

Edited by metjan.baduni


It seems like there are no fields with those names in the pedagogu table. Can you check whether you have spelled the index names correctly and same as field names (sorry to bother you with one more check but nothing else seems to be incorrect).

You can also try to put this debug code right after line 9:

die(print_r($row, 1));

It will display the array for the first row. You can check indexes there.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.