-1
if($tsk != ""){
    $SQL = "SELECT * FROM $tsk WHERE username = '$user'";
    $result = mysql_query($SQL);
    while ($db_field = mysql_fetch_assoc($result)) {
        $acc = $db_field['accepted'];
    }


    if($acc == 1){
        die("<script>location.href = 'task_mem_acc.php'</script>");
    }
}

Notice: Undefined variable: tsk in C:\xampp\htdocs\online\Online Task Management System\task_mem.php on line 80

This problem always appear,

how to fix this problem?

please help me master!

1 Answers1

0

$tsk is not defined . change your code to this.

if(isset($tsk) && $tsk != ""){
    $SQL = "SELECT * FROM $tsk WHERE username = '$user'";
    $result = mysql_query($SQL);
    while ($db_field = mysql_fetch_assoc($result)) {
        $acc = $db_field['accepted'];
    }


    if($acc == 1){
        die("<script>location.href = 'task_mem_acc.php'</script>");
    }
}
Tariq hussain
  • 614
  • 5
  • 11
  • Beside that there are tons of dupe's for this question, this line: `if(isset($tsk) && $tsk != ""){` is the same as: `if(!empty($tsk))` – Rizier123 Mar 02 '15 at 12:30
  • I had declare $tsk. This is my coding. if (isset($led_nem)) { $SQL = "SELECT * FROM info WHERE username = '$led_nem'"; $result = mysql_query($SQL); while ($db_field = mysql_fetch_assoc($result)) { $tsk = $db_field['group_task']; } } – user3367832 Mar 02 '15 at 12:45