in PHP by
Q:
How can I prevent SQL injection in PHP?

► Click here to show 1 Answer

0 votes
by

Use PDO and prepared queries.

($conn is a PDO object)

$stmt = $conn->prepare("INSERT INTO tbl VALUES(:id, :name)");
$stmt->bindValue(':id', $id);
$stmt->bindValue(':name', $name);
$stmt->execute();
Learn More with Madanswer

Related questions

0 votes
asked Jun 22, 2019 in PHP by SakshiSharma
...