php 修改不了数据解决思路

WBOY
Release: 2016-06-13 12:03:00
Original
939 people have browsed it

php 修改不了数据
我只是初学的php,希望各位老师请教



    if($_GET["type"]=="modify"){

$id=$_GET['id'];
if($_POST["Submit3"])
{
$sql="update t_user  set f_username='$a', f_sex='$b',f_age='$c',f_CT='$d',f_zaoyingji='$f',f_buwei='$g',f_HU='$h',f_jishu='$i',f_xiaoaguo='$j',f_qianming='$k',f_yanchi_time='$l',f_chufa_time='$m' where id=$id";
mysql_query($sql);
echo "<script>alert('修改成功!');window.location='index.php'</script>";
}
$sql="select * from t_user where id=$id";
$rs=mysql_query($sql);
$ros=mysql_fetch_row($rs);
?>
$result=$connection->query("select * from t_user where id=$id limit 1");
  while ($rws=$result->fetch_row()) {
  ?>
}
?>

------解决方案--------------------
$rs=mysql_query($sql) or die(mysql_error());  //这句改成这样报什么错。
------解决方案--------------------
php 说你没有选择数据库,那就是你没有选择数据库!
------解决方案--------------------
mysql_select_db()这个是怎么设置?
------解决方案--------------------
你用 mysqli 连接数据库
却用 mysql_query($sql); 操作数据库
这整么可以呢?

虽然 mysql 扩展和 mysqli 扩展都用于操作 mysql 数据库
但它们是两套不同的东西,不能混用!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!