|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-03-02 18:41 UTC] rok dot meglic at gmail dot com
[2009-04-21 07:03 UTC] jani@php.net
[2009-05-05 10:07 UTC] rok dot meglic at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 05:00:01 2025 UTC |
Description: ------------ After we LEFT JOIN two tables and use ORDER BY on foreign table field the MySQLI doesn't return the primary key flag correctly trough fetch_field operation. The result is the same regardless of OS. MySQL 5.x is used. Reproduce code: --------------- $query = "select cn.id from c_news cn LEFT JOIN c_news_categories cc ON cc.id = cn.area ORDER BY cc.name"; // if we dont use ORDER BY cc.name, the primary flag is set correctly if ($result = $mysqli->query($query)) { while ($finfo = $result->fetch_field()) { printf("Flags: %d\n", $finfo->flags); printf("Primary key: %d\n\n", (bool) ($finfo->flags & MYSQLI_PRI_KEY_FLAG)); } $result->close(); } Expected result: ---------------- Flags: 49699 Primary key: true Actual result: -------------- Flags: 32801 Primary key: 0