douzi8127 2014-04-07 20:30
浏览 21

查询结果(mysqli)没有显示PHP,虽然它在phpMyAdmin中有效

I'm running following query in phpMyAdmin and I receive the expected results, but when I try to display it with PHP I can't see anything in browser and any error message as well!

Hier the code:

// Displays the erros. 
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL);

// Here the query
$query = "
SELECT
    p.auth,
    p.nr,
    p.kind,
    (SELECT i.family FROM table02 i WHERE p.family = i.family LIMIT 1) family,
    (SELECT group_concat(i.class) FROM table03 i WHERE p.family = i.family) class,
    (SELECT a.appl FROM table04 a WHERE p.family = a.family) appl,
    p.date,
    (SELECT s.sim FROM table05 s WHERE p.family = s.num2 LIMIT 1) sim
FROM
    table01 p
WHERE
    p.family = 1
ORDER BY sim DESC";

$result = mysqli_query($link, $query) or die ("Couldn't execute query: ".mysqli_error());

// Echoes the table with the result of the query.
echo "<table>
";
while($row = mysqli_fetch_array($result))
{
    echo "<tr>
";
    echo "<td>".$row['auth']$row['nr']$row['kind']."</td><td>".$row['family']."</td><td>".$row['class']."</td><td>"."</td><td>".$row['appl']."</td><td>"."</td><td>".$row['date']."</td><td>"."</td><td>".$row['sim']."</td>
";
    echo "</tr>
";
}
echo "</table>
";

First of all, what I should do to receive a feedback from PHP showing the possible wrong lines of the code?

Moreover, is there any problem by display of the table? I have a very similar code that display another query very well. The only difference is that the query is not so complex like this one we have here. But I don't believe that the query is wrong, because it works fine in phpMyAdmin giving me the expected results.

Many thanks in advance for your help!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?