0

I'm using ZF1 latest version.

My table looks like this:

CREATE TABLE `mytable` (
    `id` INT(11) NOT NULL DEFAULT '0',
    `right_value` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
)
COLLATE='utf8_general_ci'
ENGINE=MyISAM
CHECKSUM=1;

When I do something like this:

$sel = new Zend_Db_Select($zdb);
$sel->from($table)
    ->order($tablePk);
$dbData = $zdb->fetchAll($sel);

I get the value of my column right_value as an int. Logically if the BIGINT is big enough I get wrong values in php.

I googled around but all I found was that people complain about getting int as string, not the other way round.

I'm using mysqli as a setup for my Zend Adapter.

Any ideas how I get the value as string so php won't alter it?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Ron
  • 22,128
  • 31
  • 108
  • 206
  • You say 'logically' you get the wrong values, but the PHP int max is the same as the bigint max (unless for some reason you are using a 32-bit OS). What does `echo PHP_INT_MAX;` from the PHP command line give you? – Tim Fountain Feb 05 '18 at 13:45
  • I'm on Win10 64bit, php 5.6. I get `2147483647` for the echo. – Ron Feb 06 '18 at 14:12
  • I think there used to be an issue with this on Windows but I thought that was fixed a while ago. I'm afraid I don't have a Windows machine to check from. – Tim Fountain Feb 06 '18 at 16:59
  • 1
    Also, from http://windows.php.net/download: "The x64 builds of PHP 5 for Windows are experimental, and do not provide 64-bit integer or large file support." So if you are in a position to upgrade to PHP 7 that might fix it. – Tim Fountain Feb 06 '18 at 17:07
  • Interesting. So ZendDb thinks I'm on 64bit and I'm fine but acutally the php build is buggy and I'm not. Makes sense! Thx! Btw: I changed the data semi-automated to string, now I get what I want - but I was curious. Maybe you can add this as an answer? Then I'll accept it. – Ron Feb 07 '18 at 21:25
  • @TimFountain If you post your comment as an answer, I'll accept it. Maybe helps somebody else as well. – Ron Aug 07 '18 at 08:41

0 Answers0