$form=M('user');????
成都服務(wù)器托管,創(chuàng)新互聯(lián)提供包括服務(wù)器租用、成都服務(wù)器托管、帶寬租用、云主機(jī)、機(jī)柜租用、主機(jī)租用托管、CDN網(wǎng)站加速、域名與空間等業(yè)務(wù)的一體化完整服務(wù)。電話咨詢:13518219792
$result=$form-where(array('username'=''))-select();???
//?下面就是打印這條sql語(yǔ)句的方法????
$form-getLastSql();
你好,一共有兩種方法可以打印sql語(yǔ)句,具體實(shí)現(xiàn)方法可參照這篇文章:
ThinkPHP5打印sql語(yǔ)句
[?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
$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']);
?