<?php
try {
$db = new PDO("mysql:host=localhost;dbname=kantin", "root", "");
$db->query("SET CHARACTER SET utf8");
} catch ( PDOException $e ){
print $e->getMessage();
}
try {
$sql = "INSERT INTO yiyecekler (y_ad, y_fiyat, y_marka)
VALUES ('Eray',5, 'Optimum')";
// use exec() because no results are returned
$db->exec($sql);
echo "New record created successfully";
}
catch(PDOException $e)
{
echo $sql . "<br>" . $e->getMessage();
}
?>
Bir yanıt bırakın Cevabı iptal et