“PHP PDO SELECT” Kode Jawaban

PHP PDO SELECT

// select a particular user by id
$id = 1 ;
$stmt = $pdo->prepare("SELECT * FROM users WHERE id=?");
$stmt->execute([$id]); 
$user = $stmt->fetch();
mouaadBch

PHP Query PDO


<?php
$sql =  'SELECT name, color, calories FROM fruit ORDER BY name';
foreach  ($conn->query($sql) as $row) {
    print $row['name'] . "\t";
    print  $row['color'] . "\t";
    print $row['calories'] . "\n";
}
?>

Crazy Crane

PHP PDO SQL Server Connect

$db = new PDO("sqlsrv:Server=YouAddress;Database=YourDatabase", "Username", "Password");
Mobile Star

PHP PDO SELECT

$stmt = $pdo->prepare("SELECT * FROM table WHERE id = ?");
$stmt->execute([$id]);
$result = $stmt->fetchAll();
mvmrik

php pdo mengambil dari db

$pdo = new PDO('mysql:host=$host; dbname=$database;', $user, $pass);
$stmt = $pdo->prepare('SELECT * FROM auction WHERE name = :name');
$stmt->bindParam(':name', $_GET['searchdivebay']);
$stmt->execute(array(':name' => $name);
Zeevx

Jawaban yang mirip dengan “PHP PDO SELECT”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya