mysql的sql语言
<?session_start();if($_SESSION['admin']=="OK"){$conn=mysql_connect("localhost","root"...
<?
session_start();
if($_SESSION['admin']=="OK")
{
$conn=mysql_connect ("localhost", "root", "123456");
mysql_query("set names GB2312"); //解决中文乱码问题
mysql_select_db("guest_book");
$exec="select * from contents where id=".$_GET['id'];
$exec="update contents set content='".$_POST['post_contents']."' where id=".$_POST['id'];
$result=mysql_query($exec);
}
mysql_close();
header("location:admin_index.php");
?>
这里 $exec="select * from contents where id=".$_GET['id'];
$exec="update contents set content='".$_POST['post_contents']."' where id=".$_POST['id'];二句是为了修改列的值,不明白的是只用第二句直接修改不行吗,还用 $exec="select * from contents where id=".$_GET['id'];这句做什么用呢?? 展开
session_start();
if($_SESSION['admin']=="OK")
{
$conn=mysql_connect ("localhost", "root", "123456");
mysql_query("set names GB2312"); //解决中文乱码问题
mysql_select_db("guest_book");
$exec="select * from contents where id=".$_GET['id'];
$exec="update contents set content='".$_POST['post_contents']."' where id=".$_POST['id'];
$result=mysql_query($exec);
}
mysql_close();
header("location:admin_index.php");
?>
这里 $exec="select * from contents where id=".$_GET['id'];
$exec="update contents set content='".$_POST['post_contents']."' where id=".$_POST['id'];二句是为了修改列的值,不明白的是只用第二句直接修改不行吗,还用 $exec="select * from contents where id=".$_GET['id'];这句做什么用呢?? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询