$param = "%{$_POST['user']}%";$stmt = $db->prepare("SELECt id,Username FROM users WHERe Username LIKE ?");$stmt->bind_param("s", $param);$stmt->execute();$stmt->bind_result($id,$username);while ($stmt->fetch()) { echo "Id: {$id}, Username: {$username}";}
或者您也可以:
$param = "%{$_POST['user']}%";$stmt = $db->prepare("SELECt id,Username FROM users WHERe Username LIKE ?");$stmt->bind_param("s", $param);$stmt->execute();$result = $stmt->get_result();while ($row = $result->fetch_array(MYSQLI_NUM)) { foreach ($row as $r) { print "$r "; } print "n";}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)