Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
create table tbl1 (
id int,
val varchar(64)
);
insert into tbl1 values (1, 'Test1');
<?php
$value = 'Test1';
$sql = "SELECT EXISTS(SELECT * FROM `tbl1` WHERE `val` = ? LIMIT 1)";
$stmt = mysqli_prepare($mysqli, $sql);
mysqli_stmt_bind_param($stmt, "s", $value);
$sqlResult = mysqli_stmt_execute($stmt);
echo '$sqlResult: ' . $sqlResult . $br;