“PHP PDO SELECT” Respostas de código

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 Fetch de 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

Respostas semelhantes a “PHP PDO SELECT”

Procure respostas de código populares por idioma

Procurar outros idiomas de código