Medoo框架完成具备增删改查功能

Original 2019-09-05 18:04:49 242
abstract: 'mysql', &n
 'mysql', 'database_name' => 'php_edu', 'server' => '127.0.0.1', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'port' => 3306, ]); //数据查询 //$rows = $db -> select('user',['user_id','name','sex','age','email','create_time'],['status'=>1]); //$rows = $db -> select('user',['user_id','name','sex','age','email','create_time'],['age[>]'=>30]); //$rows = $db -> select('user',['user_id','name','sex','age','email','create_time'],['OR'=>['age[>]'=>30,'sex'=>1]]); //foreach ($rows as $row) { // echo print_r($row,true) .'
'; //} //数据添加 //$table = 'user'; //$data = [ // 'name' => '未命名', // 'sex' => 1, // 'age' => 55, // 'email' => 'wmm@qq.com', // 'password' => sha1('123456'), // 'status' => 1, // 'create_time' => time() //]; //$stmt = $db -> insert($table,$data); // //echo var_dump($stmt,true) .'
'; // //echo 'SQL语句:' .$stmt -> queryString .'
'; // //echo '新增加的主键是:' .$db -> id() .'
'; // //echo print_r($stmt -> errorInfo()); // //echo '
'; // //$num = $stmt -> rowCount(); // //if ($num > 0) { // echo '成功添加' .$num .'条记录'; //} //数据修改 //$table = 'user'; //$data = [ // 'email' => 'wmm@163.com', // 'status' => 0, // 'create_time' => time() //]; //$where = ['user_id' => 43]; //$stmt = $db -> update($table,$data,$where); // //$num = $stmt -> rowCount(); // //if ($num > 0) { // echo '成功更新' .$num .'条记录'; //} //数据删除 $table = 'user'; $where = ['user_id' => 54]; $stmt = $db -> delete($table,$where); $num = $stmt -> rowCount(); if ($num > 0) { echo '成功删除' .$num .'条记录'; }


Correcting teacher:天蓬老师Correction time:2019-09-06 15:29:07
Teacher's summary:这是一个单文件的数据库管理工具, 类似adminer

Release Notes

Popular Entries