PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
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;
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;
Show:  
Copy Clear