<?php
$userName=$_POST["userName"];
$userPwd=$_POST["userPwd"];
if(empty(trim($userName)) || empty(trim($userPwd)))
echo("失败<br>");
else
echo("成功<br>");
$link = mysqli_connect('localhost','root','123456','mytest');
if(!$link){
echo("NO<br>");
}
else{
echo("OK<br>");
}
$sql = "SELECT * FROM student";
$result = mysqli_query($link,"INSERT INTO student(ID,name) VALUES(12435,'Zcm')");
if($result){
echo "插入成功!";
}
else{
echo "插入失败!".mysqli_error($link);
}
$result = mysqli_query($link,$sql);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
echo "id: " . $row["ID"]. " - Name: " . $row["name"]. "<br>";
}
} else {
echo "0 结果";
}
?>
|