'Uncaught PDOException: SQLSTATE[42000] update error

I got this error while trying to update information in mysql server:

'Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '* FROM ogrenci WHERE ID=' at line 1 in D:\Php\xampp\htdocs\workworkwork\index.php:78
Stack trace:
#0 D:\Php\xampp\htdocs\workworkwork\index.php(78): PDOStatement->execute()
#1 {main} thrown in D:\Php\xampp\htdocs\workworkwork\index.php on line 78'

How can i solve this?

        $id=$_REQUEST['ID'];
        $sql = "SELECT * FROM ogrenci WHERE ID=$id";
        $sonuc= $db->prepare($sql);
        $sonuc->execute();
        $rs=$sonuc->fetch(PDO::FETCH_ASSOC);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source