$db_host = 'localhost';
$db_user = 'root';
$db_password = '';
$db_name = 'allonpage';
$con = new mysqli('localhost', $db_user, $db_password, $db_name);
if ($con->connect_error)
die('Connection Error: ' . $con->server_info);
if ($stmt = $con->prepare("SELECT src, alt FROM images WHERE alt LIKE ?"))
{
$alt = 'w%';
$stmt->bind_param('s', $alt); // 's' = variable type string
$stmt->execute();
if ($stmt->errno)
die("Error: " . $stmt->error);
$stmt->bind_result($src, $alt);
$stmt->fetch();
echo $src . " - " . $alt;
$stmt->close();
}
$con->close();
/*
run:
http://www.ws.com/images/logo-wordpress.png - wordpress logo
*/