Integer in DB becomes string in PHP?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hello,

I have a table "test_table" with one column:
number int(11)
(also see phpmyadmin database dump at the end of this mail).
it has two values, 123 and 150.

i select and output one of those numbers using the following code:
--- php code start ---
<?
error_reporting(E_ALL);

$con=mysql_connect('127.0.0.1', 'root', '');
mysql_select_db('testdb', $con);
$result=mysql_query('select * from test_table where number=123');
$row=mysql_fetch_array($result);


print_r($row);

var_dump($row['number']);
?>
--- php code end ---

that outputs:
--- output start ---

Array
(
    [0] => 123
    [number] => 123
 )
string(3) "123"
--- output end ---



1) Is this normal?
2) Can this behaviour be changed / fixed?

Thanks!





       
---------------------------------
 Wissenswertes für Bastler und Hobby Handwerker.BE A BETTER HEIMWERKER!

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux