| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2006-11-27 14:57 UTC] derick@php.net
  [2006-11-27 15:11 UTC] harmen_php_net at xtremesf dot nl
  [2006-11-27 15:23 UTC] tony2001@php.net
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 08:00:01 2025 UTC | 
Description: ------------ When executing the query below, I get the wrong result. Although the database returns a integer, PHP treats it as a string. Here the relevant part of phpinfo(): MysqlI Support enabled Client API library version 5.0.27 Client API header version 5.0.27 MYSQLI_SOCKET /tmp/mysql.sock The version of the MySQL server is 5.0.27 Reproduce code: --------------- <pre> <?php $rDB = mysqli_connect('localhost', 'user', 'password', 'db'); mysqli_select_db($rDB, 'db'); $rResult = mysqli_query($rDB, 'SELECT id FROM producten WHERE id = 4472'); var_dump(mysqli_fetch_array($rResult)); echo "\n---\n"; var_dump(mysqli_fetch_field($rResult)); ?> </pre> Expected result: ---------------- array(2) { [0]=> int(4) "4472" ["id"]=> int(4) "4472" } --- object(stdClass)#3 (11) { ["name"]=> string(2) "id" ["orgname"]=> string(2) "id" ["table"]=> string(9) "producten" ["orgtable"]=> string(9) "producten" ["def"]=> string(0) "" ["max_length"]=> int(4) ["length"]=> int(11) ["charsetnr"]=> int(63) ["flags"]=> int(49699) ["type"]=> int(3) ["decimals"]=> int(0) } Actual result: -------------- array(2) { [0]=> string(4) "4472" ["id"]=> string(4) "4472" } --- object(stdClass)#3 (11) { ["name"]=> string(2) "id" ["orgname"]=> string(2) "id" ["table"]=> string(9) "producten" ["orgtable"]=> string(9) "producten" ["def"]=> string(0) "" ["max_length"]=> int(4) ["length"]=> int(11) ["charsetnr"]=> int(63) ["flags"]=> int(49699) ["type"]=> int(3) ["decimals"]=> int(0) }