//连接数据库 $mysqli = new mysqli("localhost", "root", "root", "mobilemoms"); !$mysqli->connect_error or die("CONNECT SQL ERROR".$mysqli->connect_error); $mysqli->query("set names utf8"); //sql预编译 $sql = "select tally_name,machine_no from device_member where mobile_no=? and mobile_pwd=? limit 1"; $mysqli_stmt = $mysqli->prepare($sql); //绑定参数 $mysqli_stmt->bind_param("ss",$mobileno,$pwd);//绑定查询参数 $mysqli_stmt->bind_result($tally_name,$machine_no);//绑定结果参数 也就是将查询结果直接给某参数 //处理查询结果 $mysqli_stmt->execute(); if(!$mysqli_stmt->fetch()){ //没有内容 wrong("No User"); }else{//有内容 echo "success"; }
原文地址:https://www.cnblogs.com/iAmSoScArEd/p/11719610.html
时间: 2024-10-13 09:22:42