mysqli and php requesting rows returned in object oriented scripting
in object oriented php mysqli
I am trying to request a username, and retur开发者_如何学Gon if it matches a row, without actually returning any user data.
How would I write this?...so far I have...
$sql = "SELECT NULL FROM database WHERE usernick=?";
$stmt = $link->prepare($sql)
$stmt->bind_param('s', $snr);
$stmt->execute();
After this step I need to see if a row matched the query...but I have no idea how to write it, everyone here pretty much writes in mysql if I dont mention I want object oriented mysqli :S
I'd do it like this:
$stmt->execute();
/* store result */
$stmt->store_result();
printf("Number of rows: %d.\n", $stmt->num_rows);
/* close statement */
$stmt->close();
Cheers,
Fabian
精彩评论