web前端全系列 教程
1839个小节阅读:2243.6k
目录
鸿蒙应用开发
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
xxxxxxxxxx
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form action="index.php" method="post">
账号:<input type="text" name="username" id="" value="">
<br>
密码:<input type="text" name="password" id="" value="">
<br>
<input type="submit" value="提交">
</form>
</body>
</html>
xxxxxxxxxx
$username = $_POST['username'];
$password = $_POST['password'];
$con=mysqli_connect('localhost','root','','itbaizhan');
if($con){
mysqli_query($con,'set names utf8');
$sql="select * from user where username='$username' and password='$password'";
$result=mysqli_query($con,$sql);
if($result -> num_rows >0 ){
echo '登陆成功';
}else{
echo '账户或者密码错误';
}
}else{
echo '连接失败';
}
实时效果反馈
1. 下列代码,换横线处应该填写代码是:
xxxxxxxxxx
$username = $_POST['username'];
$password = $_POST['password'];
$con=___('localhost','root','','itbaizhan');
if($con){
mysqli_query($con,'set names utf8');
$sql="select * from user where username='$username' and password='$password'";
$result=mysqli_query($con,$sql);
if($result -> num_rows >0 ){
echo '登陆成功';
}else{
echo '账户或者密码错误';
}
}else{
echo '连接失败';
}
A query
B connect
C mysqli_connect
D mysqli
答案
1=>C