mysqli - Do multiple (query) check (optimze) in PHP -
i want ask, there how short script
first check, if uid
, second , third check
$result = mysqli_fetch_row(mysqli_query($con, "select max(`uid`) `pvpgn_bnet`")); if($result) { second , first check(); }
second check
$result = mysqli_fetch_row(mysqli_query($con, "select * `pvpgn_bnet` acct_email = '" . $email . "'")); if($result) { errormsg(); }
third check
$result = mysqli_fetch_array(mysqli_query($con, "select `uid` `pvpgn_bnet` acct_username = '" . $username . "'"), mysqli_both); if($result) { errormsg(); }
i dont know first filter (it doesnt make sense), second , third can combined. consider example:
$mysqli = new mysqli("localhost", "my_user", "my_password", "world"); $stmt = $mysqli->prepare("select * pvpgn_bnet acct_email=? or acct_username=?") $stmt->bind_param("ss", $email, $username); $stmt->execute(); // other processes $res = $stmt->get_result(); while($row = $res->fetch_array(mysqli_assoc)) { // ever want here }
Comments
Post a Comment