收藏php

收藏php,第1张

PHP数据库

以下是PHP数据库的代码:

<html><head><title></title><meta http-equiv="Content-Type" content="text/html;charset=utf-8"/><style type="text/css">body{background-color: cyan;margin:0 550px 0 516px;padding: 0;font-family: "微软雅黑";}</style></head><?phpif(@$_POST[‘submit‘]){$name =$_POST["name"];$xinb = $_POST["xinb"];$age = $_POST["age"];$haoma = $_POST["haoma"];$dizhi = $_POST["dizhi"];$conn = @mysql_connect("localhost","root","") or die("数据库连接失败,请检查你的网络,稍后再试试");mysql_select_db("test");mysql_query("set names ‘utf8‘");$sql ="INSERT INTO `test`.`message` (`id`, `name`, `xinb`, `age`, `haoma`, `dizhi`)VALUES (NULL, ‘$name‘, ‘$xinb‘, ‘$age‘, ‘$haoma‘,‘$dizhi‘)";mysql_query($sql);mysql_close($conn);}?>

<body><marquee behaviof="alternate"><font size="8" color="red">学生管理系统</font></marquee><form action="php_mysql_list.php" method="post"><br/>名字: <input type="text" name="name" style="width: 230px"/> <br/>性别: <input type="text" name="xinb" style="width: 230px"/> <br/>年龄: <input type="text" name="age" style="width: 230px"/> <br/>电话: <input type="text" name="haoma" style="width: 230px"/> <br/>住址: <textarea name="dizhi" cols="30" rows="10"></textarea> <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="submit" value="添加"> <br/></form>

</body></html>

里面主要是以   POST     以及  灵活运用PHPMYAMMIN 软件  和  添加表   和数据  ()到数据库  和  删除  表   ($sql = "delete from `message` where id=$id";)

 

收藏php,码迷,mamicode.com

收藏php

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/1006937.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存