Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear
-- Hint: use Ctrl+Enter for SQL autocomplete create table accountInfo ( email varchar(255), index (email) ); insert into accountInfo values ('yes@mail.com'); select * from accountInfo;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php function emailExists($conn, $email) { $stmt = $conn->prepare("SELECT 1 FROM accountInfo WHERE email=?"); $stmt->bind_param('s', $email); $stmt->execute(); $stmt->store_result(); return $stmt->num_rows; } $email = 'no@mail.com'; echo $email . ': ' . emailExists($mysqli, $email) .PHP_EOL; $email = 'yes@mail.com'; echo $email . ': ' . emailExists($mysqli, $email) .PHP_EOL;
Copy Clear