9951 explained code solutions for 126 technologies


php-pdoInsert query example using PHP PDO


$st = $pdo->prepare('INSERT INTO test SET name = :name, age = :age');
$st->execute([':name' => 'Donald', ':age' => 90]);ctrl + c
$pdo->prepare

prepare given query to execute

$st->execute(

run query on the server

SET name = :name, age = :age

use placeholders to insert safe values

[':name' => 'Donald', ':age' => 90]

values we want to insert into table