jeudi 23 juin 2016

Receiving a warning - Notice: Undefined index [duplicate]

This question already has an answer here:

I am just trying to print a few results for testing purposes but it generates the complete code instead. I am not sure how to fix it.

<?php
include "config.php";

function getfinalsp($gid, $lv) {
    $ids = mysql_query("select * from actstatus where regid = '$gid'");
    $row = mysql_fetch_array($ids);
    $val = $row[$lv];
    $fv = $row['regid'];
    if($fv == $gid && $val != 'Yes') {
        $gs = mysql_query("select * from register where username = '$gid'");
        $grow = mysql_fetch_array($gs);
        $gval = $grow['sid'];
        getfinalsp($gval, $lv);
    }
    return $val;
}

$sp = "sam";
$vl = "123";
$act = getfinalsp($sp, $vl);

echo $act;

?>

In the above code I passed $sp, $sl variables for mysql query but I get this error:

Notice: Undefined index: 123 in C:xampphtdocsabcsam2.php on line 16

Aucun commentaire:

Enregistrer un commentaire