Answers for "check table is exist or not php pdo"

PHP
0

php pdo Check if row exists in the database

$stmt = $conn->prepare('SELECT * FROM table WHERE ID=?');
$stmt->bindParam(1, $_GET['id'], PDO::PARAM_INT);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);

if( ! $row)
{
    echo 'nothing found';
}

/*
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC); // Same here
if( ! $rows)
{
    echo 'nothing found';
}
*/
Posted by: Guest on October-16-2021
0

pdo table exists

function emailExists($pdo, $email) {    $stmt = $pdo->prepare("SELECT 1 FROM users WHERE email=?");    $stmt->execute([$email]);     return $stmt->fetchColumn();)if (emailExists($pdo, $email)) {    // found}
Posted by: Guest on September-13-2021

Code answers related to "check table is exist or not php pdo"

Browse Popular Code Answers by Language