Focus mode
CREATE
// TEK VERİ EKLEME
$sql = "INSERT INTO test
SET isim = 'Ahmet', soyisim = 'ERSEVER', abonelikler = 'A,B,C'";
$query = $db->query($sql);
if ( $query->rowCount() ){
echo $query->rowCount().' adet veri eklendi';
}
// ÇOKLU VERİ EKLEME
$sql = "INSERT INTO test (isim, soyisim, abonelikler)
VALUES ('Ahmet', 'ÇAKAR', 'A,D'),
('Musa', 'KALKAN', 'D'),
('Mehmet', 'BÜYÜK', 'F')";
$query = $db->query($sql);
if ( $query->rowCount() ){
echo $query->rowCount().' adet veri eklendi';
}
$sql = "UPDATE test SET isim = 'ŞAHİN' WHERE id = 1";
$query = $db->query($sql);
if ( $query->rowCount() ){
echo $query->rowCount().' adet veri güncellendi';
}
$sql = "SELECT * FROM test";
$query = $db->query($sql);
if ( $query->rowCount() ){
print_r($query->fetchAll(PDO::FETCH_ASSOC));
}
$sql = "SELECT * FROM test WHERE id = 1";
$query = $db->query($sql);
if ( $query->rowCount() ){
print_r($query->fetch(PDO::FETCH_ASSOC));
}
$sql = "DELETE FROM test WHERE id > 10";
$query = $db->query($sql);
if ( $query->rowCount() ){
echo $query->rowCount(). ' adet satır silindi.';
$query = $db->prepare("INSERT INTO test SET
isim = ?,
soyisim = ?,
abonelikler = ?");
$insert = $query->execute(["Fatma", "BURAK", "A,B,C"]);
if ( $query->rowCount() ){
echo $db->lastInsertId();
echo ' '.$query->rowCount()." adet satır etkilendi!";
}
Programs to Accelerate Your Progress in a Software Career
Join our 4-8 month intensive Patika+ bootcamps, start with the fundamentals and gain comprehensive knowledge to kickstart your software career!
You need to enroll in the course to be able to comment!