PHPize Online / SQLize Online

A A A
Share   Donate   Blog   Popular
Copy Format Clear
Copy
Copy Format Clear
<?php mysqli_report(MYSQLI_REPORT_OFF); $mysqli->query("create table users (id int)"); $mysqli->query("insert into users values (1111111111)"); isExist($mysqli, 1111111111); function isExist(mysqli $conn, $id) { $sql = "select * from users where id = ?"; $stmt = mysqli_stmt_init($conn); mysqli_stmt_prepare($stmt,$sql); mysqli_stmt_bind_param($stmt,"s",$id); mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); if($result->num_rows>0){ echo "num bigger than 0"; return true; } echo $result->num_rows; echo "num is 0"; return false; }
Show:  
Copy