php打印数据库语句 php里输出数据库数据函数
thinkphp怎么打印sql语句
$form=M('user');
成都服务器托管,创新互联提供包括服务器租用、成都服务器托管、带宽租用、云主机、机柜租用、主机租用托管、CDN网站加速、域名与空间等业务的一体化完整服务。电话咨询:13518219792
$result=$form-where(array('username'=''))-select();
// 下面就是打印这条sql语句的方法
$form-getLastSql();
请教大神thinkphp5 怎么打印sql语句
你好,一共有两种方法可以打印sql语句,具体实现方法可参照这篇文章:
ThinkPHP5打印sql语句
[ SQL ] SHOW COLUMNS FROM `think_action` [ RunTime:0.001339s ]
[ EXPLAIN : array ( 'id' = '1', 'select_type' = 'SIMPLE', 'table' = 'think_action', 'partitions' = NULL, 'type' = 'ALL', 'possible_keys' = NULL, 'key' = NULL, 'key_len' = NULL, 'ref' = NULL, 'rows' = '82', 'filtered' = '100.00', 'extra' = NULL, ) ]
[ SQL ] SELECT * FROM `think_action` LIMIT 1 [ RunTime:0.000539s ]
写一个php查询语句并找打印出来
?php
$db_host='localhost';
$db_name='test123';
$db_user='test123';
$db_psd='test123';
mysql_connect($db_host,$db_user,$db_psd);
mysql_select_db($db_name);
$sql="select * from `group`";
$res=mysql_query($sql);
if($resmysql_num_rows($res)0){
$row=mysql_fetch_assoc($res);
}
echo ($row['title']);
?
文章题目:php打印数据库语句 php里输出数据库数据函数
地址分享:http://azwzsj.com/article/ddohhjh.html