码迷,mamicode.com
首页 > 数据库 > 详细

$w=$mysqli->query($sql);

时间:2016-09-05 01:31:21      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

 1 $db = new mysqli(‘localhost‘, ‘root‘, ‘‘, ‘w‘);
 2 if($db->connect_error){
 3     die(‘Connect Error ( ‘.$db->connect_errno.‘ )‘.$db->connect_error);
 4 }
 5 echo ‘Connect OK.<br>‘; 
 6 $wtab = ‘w‘.rand(123,987);
 7 $w = $db->query("CREATE TABLE $wtab (w int)");
 8 var_dump($w);
 9 $w = $db->query("INSERT INTO $wtab VALUES(123)");
10 var_dump($w);
11 $w = $db->query("SELECT * FROM $wtab");
12 var_dump($w);

 

Connect OK.
D:\wamp64\www\wdb.php:21:boolean false
D:\wamp64\www\wdb.php:23:boolean true
D:\wamp64\www\wdb.php:25:
object(mysqli_result)[3]
  public ‘current_field‘ => int 0
  public ‘field_count‘ => int 1
  public ‘lengths‘ => null
  public ‘num_rows‘ => int 2
  public ‘type‘ => int 0

 

$w=$mysqli->query($sql);

标签:

原文地址:http://www.cnblogs.com/yuanjiangw/p/5840861.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!