PHP页面根据id跳转到指定页面

weixin_43365307 2019-03-22 05:48:22
news. php页面中点击删除,页面跳转到news_del. php。当点击第二行的删除时,页面跳转的news_del.php ? id=2,以此类推。 news.php,news_del. php中的代码要怎么写? 附上news.php代码: <?php require_once('../Connections/web_ljdata.php'); ?> <?php require_once('../Connections/web_ljdata.php'); ?> <?php mysql_query("set names 'utf8'"); if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_web_ljdata, $web_ljdata); $query_news = "SELECT * FROM web_news"; $news = mysql_query($query_news, $web_ljdata) or die(mysql_error()); $row_news = mysql_fetch_assoc($news); $totalRows_news = mysql_num_rows($news); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>新闻管理</title> </head> <body> <p><a href=" ">添加新闻</a ></p > <table width="100%" border="1" cellpadding="5"> <tr bgcolor="#b2e4f9"> <td>操作</td> <td>新闻编号</td> <td>新闻标题</td> <td>主题内容</td> <td>发布时间</td> </tr> <?php do { ?> <tr> <td><?php echo "<a href='news_del.php?id=".$row_news['id']."'>删除</a >"?></td> <td><?php echo $row_news['id']; ?></td> <td><?php echo $row_news['title']; ?></td> web-ljdata.php <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_web_ljdata = "localhost"; $database_web_ljdata = "web_data"; $username_web_ljdata = "root"; $password_web_ljdata = "root"; $web_ljdata = mysql_pconnect($hostname_web_ljdata, $username_web_ljdata, $password_web_ljdata) or trigger_error(mysql_error(),E_USER_ERROR); ?>
...全文
114 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧