0

I am trying to fetch a row from MySQL DataBase in PHP for a particular id. After Fetching I want to store individual elements of the row in some variables, which are to be used later in the webpage.

$sql = "SELECT * FROM complaints WHERE complainer='$fullname' AND id='$id'";
$result = $conn->query($sql);
if($result->num_rows==1)
{
    while($row=$result->fetch_assoc())
    {
         $department=row["department"];
         $complaint_type=row["complaint_type"];
         $subject=row["subject"];
         $detail=row["details"];
         $complaint_date=row["complaint_date"];
         $officer_responsible=row["officer_responsible"];
         $complaint_status=row["complaint_status"];
         $reminder_sent=row['reminder_sent'];

    }
}

I am doing this, but it throws an error while assigning values

Parse error: syntax error, unexpected '[', expecting ',' or ';'

Whats wrong in it?

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141

0 Answers0