无为清净楼资源网 Design By www.qnjia.com

后台使用php,前台引用jquery,实现增删操作,代码如下:

复制代码 代码如下:
<script type="text/javascript" src="/UploadFiles/2021-04-02/jquery-1.10.2.min.js"><?php
header("Content-type: text/html; charset=utf-8");
//mysql_connect 建立连接,mysql_close($link)关闭非永久连接,mysql_pconnect 建立永久连接
//mysql_error返回mysql函数错误信息,mysql_errno返回mysql函数错误号码
//mysql_set_charset 设置用户端字符集,mysql_select_db 选择连接数据库
//mysql_query 执行查询,mysql_num_rows返回查询记录条数
//mysql_affected_rows返回受影响的记录条数,mysql_free_result 释放结果集内存
//mysql_fetch_row 返回列举阵列记录,mysql_fetch_assoc 返回关联阵列记录
//mysql_fetch_array 返回关联阵列或数字阵列记录,mysql_fetch_object 返回物件形式记录
//mysql_fetch_result 取得结果集资料
//%s 字符串,%c 一个ASCII字符,%d 一个整数,%u 一个符号数,%x 一个十六进制数
mysql_query("set charaset set utf-8");
$message=@$_POST["message"];
$shanchu=@$_POST["shanchu"];
$top_title="PHP基础练习";
$con=mysql_connect("localhost","root","");
//连接数据库 
mysql_set_charset('utf-8',$con);
mysql_select_db("dbl",$con);
//定义数据库命令查询
$sql="select `message` ,`time`,`id` from message order by id desc limit 0,30";
//执行数据库查询
$rs=mysql_query($sql,$con);
$time=date('Y-m-d h:i:s',time());
//获取条数

$num_rows=mysql_num_rows($rs);//mysql_num_rows返回查询记录条数
if (isset($_POST["submits"])) {
if(!$_POST["message"]==null){
$queryinsert=sprintf("insert into message (message,time) values('%s','%s')",
$_POST['message'],$time);
mysql_query($queryinsert,$con);
}
    if($_POST["message"]==null){
echo "";
}
header("Location:http://localhost/table.php");
}

if(isset($_GET["ClearTd"]) && intval($_GET['ClearTd'])){
$querydelete="delete from message where id=".$_GET['ClearTd'];
    mysql_query($querydelete,$con);
header("Location:http://localhost/table.php");   
}
?>

<form method="post" action="table.php">
<textarea  name="message" id="message"></textarea>
<input type="submit" name="submits">
</form>

<ul>
<?php while($row=mysql_fetch_array($rs,MYSQL_ASSOC))
{
?>
<li>
<?php foreach($row as $tiao){
echo $tiao;
}?>
    <a name="ClearTd" href="?ClearTd=<?php echo $row['id'];?>">删除</a>
</li>      
<?php } ?>
</ul>

标签:
php,jquery,增删操作

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。