zoukankan      html  css  js  c++  java
  • php 数据操作

    删除数据
    <?php
    $con = mysql_connect("localhost","root","") or die("error");
    $mysql = mysql_select_db("monkey",$con);
    $sql = "delete from rote where id <=4";
    //$sql = "delete from rote where id='".$id."'";
    mysql_query($sql,$con);
    $row = mysql_affected_rows(); //返回影响行数
    echo $row."
    ";
    if($row > 0){
       echo "删除成功";
    }else{
       echo "删除失败";
    }
    mysql_close();
    ?>
    
    插入数据
    <?php
    $con = mysql_connect("localhost","root","");
    $mysql = mysql_select_db('monkey',$con);
    $name = 'a';
    $phone = 'b';
    $parts = 'c';
    $content = 'd';
    $sPic = 'xy/image/1407907747.jpg';
    $bPic = 'xy/image/1407907747.jpg';
    $cTime = '1407907747';
    $sql = "insert into rote (name,phone,parts,content,sPic,bPic,cTime) values('$name','$phone','$parts','$content','$sPic','$bPic','$cTime')";
    if(mysql_query($sql,$con)){
       echo "添加一条数据";
    }else{
       die(mysql_error());
    }
    mysql_close();
    ?>
  • 相关阅读:
    [转]测试的基本概念
    记录
    flash 与 程序通讯
    怎么正确的建立项目
    安装包的制作
    JS
    页面刷新定位
    [转]C#处理XML
    MSN机器人
    报表 的使用
  • 原文地址:https://www.cnblogs.com/xiaoxiaosha/p/4021565.html
Copyright © 2011-2022 走看看