ID: 39643
Updated by: [email]derickphp.net[/email]
Reported By: harmen_php_net at xtremesf dot nl
-Status: Open
+Status: Bogus
Bug Type: MySQLi related
PHP Version: 5.2.0
New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the doentation available at
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]

..


Previous Comments:
------------------------------------------------------------------------

[2006-11-27 14:51:53] harmen_php_net at xtremesf dot nl

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)
["chtnr"]=>
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)
["chtnr"]=>
int(63)
["flags"]=>
int(49699)
["type"]=>
int(3)
["decimals"]=>
int(0)
}


------------------------------------------------------------------------


--
Edit this bug report at [url]http://bugs.php.net/?id=39643&edit=1[/url]