php mysql 多表查詢 查詢不出結果?
My Code如下:
PHP code
結果就只顯示
Connected successfully
如果用
PHP code
$query="select * from jiraissue";
就會顯示相應的內容
php mysql多表查詢該怎麼寫?上面哪裡出錯了?
------解決方案--------------------
沒有表結構和真實資料,沒有真相。
你裝一個phpmyadmin,在裡面執行看看。
------解決方案--------------------
echo $row[0];
這裡改成 var_dump($row); 看看是否返回資料集正確
------解決方案--------------------
c.pname='TEST';";
不用把這個分號也複製進來
------解決方案--------------------
給點提示:
select co_balance,co_isstaff,staff_group_id,count from
(select co_balance,co_isstaff from dt_co where co_id=156) a,
(select staff_group_id from dt_staff where co_id = 156) b,
(select count(*) as count from dt_staff where staff_shouyetuijian = 1 and co_id = 156) c
這是連結用了
dt_co 和 dt_staff 做的查詢
------解決方案--------------------
把你的sql指令在phpmyadmin執行能查出結果嗎?
------解決方案--------------------
你把你這個語句拿到資料庫裡面跑一下不就知道有不有問題了
------解決方案--------------------
先用mysql_error()和mysql_errno()看看錯誤提示!
------解決方案--------------------
把php檔案的編碼統一為資料庫的編碼試試看。 可能是編碼不一致導致的誤差。
------解決方案--------------------
PHP code
$result=mysql_query($query,$link) or die("Query failed");echo "1 ".mysql_error();/*print result in html*/MySQL_num_rows($result);echo "2 ".mysql_error();while($row=mysql_fetch_array($result)){echo $row[0];echo "3 ".mysql_error();}