functioncreate($name,$age,$email){$conn=mysqli_connect("localhost","username","password","myDB");$sql="INSERT INTO users (name, age, email) VALUES ('$name', '$age', '$email')";mysqli_query($conn,$sql);mysqli_close($conn);}
读取(Read):从数据库中读取数据
functionread($id){$conn=mysqli_connect("localhost","username","password","myDB");$sql="SELECT * FROM users WHERE id=$id";$result=mysqli_query($conn,$sql);$row=mysqli_fetch_assoc($result);mysqli_close($conn);return$row;}
更新(Update):更新数据库中的数据
functionupdate($id,$name,$age,$email){$conn=mysqli_connect("localhost","username","password","myDB");$sql="UPDATE users SET name='$name', age='$age', email='$email' WHERE id=$id";mysqli_query($conn,$sql);mysqli_close($conn);}
删除(delete):从数据库中删除数据
functiondelete($id){$conn=mysqli_connect("localhost","username","password","myDB");$sql="DELETE FROM users WHERE id=$id";mysqli_query($conn,$sql);mysqli_close($conn);
题目描述
小明最近迷上了一款名为《扫雷》的游戏。其中有一个关卡的任务如下, 在一个二维平面上放置着 n 个炸雷,第 i 个炸雷 (xi , yi ,ri) 表示在坐标 (xi , yi) 处存在一个炸雷,它的爆炸范围是以半径为 ri 的一个圆。
为了顺利通过这片土…