开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜