-2

please help me with this error i could not find the solution. here's the code :

public function store_image($id) {
    $db = connection();
    $if ($db->connect_errno == 0) {
        $sql = "SELECT * from car where id='$id'";
        $res = $db->query($sql);
        while ($row = $db->fetch_assoc($res)) {
            $pic = $row['pic'];
        }
        header("content_type: image/jpg");
    }
}

the error says "Parse error: syntax error, unexpected ';'" on this line :

$sql = "SELECT * from car where id='$id'";

thanks in advance

1 Answers1

0

please change following line

$if ($db->connect_errno == 0) { 

to

if ($db->connect_errno == 0) {

Look your have added extra $ before if statement

Remove this $ from if statement.

Mehedi Hasan
  • 154
  • 6