mysql/php large integer query oddity

From: Date: Wed, 13 Nov 2002 20:03:13 +0000
Subject: mysql/php large integer query oddity
Groups: php.general 
Request: Send a blank email to php-general+get-124298@lists.php.net to get a copy of this message
I have a query oddity that looks like an integer overflow, but it shouldn't be. Excerpt from my program: <snip> #DEBUG echo "\n<br>$Query<br>\n"; #DEBUG $hResult = _do_query(__LINE__, $Query); # _do_query() simply executes mysql_query, and does nice error formatting if necessary $First = true; while ($Row = @mysql_fetch_array($hResult)) {
      if ($First) {
         $First = false;
         show_table_open($Myself);
      }
      echo
         '<tr bgcolor="', $TableColor['row1'], '">',
         '<td>', $Row['source_code'], '</td>',
         '<td>', $Row['chromo_code'], '</td>',
         '<td>', $Row['type'], '</td>',
         '<td align="right">', number_format($Row['min_exon_length']), '</td>',
         '<td align="right">', number_format($Row['max_exon_length']), '</td>',
   #     '<td>', $Row['min_exon_length'], '</td>',
   #     '<td>', $Row['max_exon_length'], '</td>',
         "</tr>\n";
} <snip> This produces the output select sm.source_code,chromo_code,type,min(end_coord-start_coord+1) as min_exon_length,max(end_coord-start_coord+1) as max_exon_length from source_master sm left join chromosome_master chm using (source_code) left join contig_master cm on (cm.chromosome_id=chm._id) left join contig_position cp on (cp.contig_id=cm._id) group by chromosome_id,type order by sm.source_code,chromo_code,type <snip>
Source Chromosome Type                  Min_exon_length  Max_exon_length
<snip>
tigr   1          pseudogene                      59           14,623
tigr   1          TIGR: unspecified type -20,699,646       29,780,051
tigr   2          pseudogene                      24            8,789
tigr   2          TIGR: unspecified type -18,834,528       16,190,138
tigr   3          pseudogene                       3            9,302
tigr   3          TIGR: unspecified type -23,058,902       14,292,141
tigr   4          pseudogene                      24            8,949
tigr   4          TIGR: unspecified type  -9,199,904        9,000,303
tigr   5          pseudogene                      12           14,463
tigr   5          TIGR: unspecified type -14,334,542       26,344,478
HOWEVER, if I cut & paste the echoed query to the mysql commandline, I get: +-------------+-------------+------------------------+-----------------+-----------------+
| source_code | chromo_code | type                   | min_exon_length | max_exon_length |
+-------------+-------------+------------------------+-----------------+-----------------+ <snip>
| tigr        | 1           | pseudogene             | 59 |           14623 |
| tigr        | 1           | TIGR: unspecified type | 2 |        29780051 |
| tigr        | 2           | pseudogene             | 24 |            8789 |
| tigr        | 2           | TIGR: unspecified type | 2 |        18834530 |
| tigr        | 3           | pseudogene             | 3 |            9302 |
| tigr        | 3           | TIGR: unspecified type | 1 |        23058904 |
| tigr        | 4           | pseudogene             | 24 |            8949 |
| tigr        | 4           | TIGR: unspecified type | 2 |         9199906 |
| tigr        | 5           | pseudogene             | 12 |           14463 |
| tigr        | 5           | TIGR: unspecified type | 2 |        26344478 |
+-------------+-------------+------------------------+-----------------+-----------------+ 75 rows in set (9.15 sec) Notice that I get bizarre results on min_exon_length for the 'unspecified type' lines; in addition, the max_exon_length is off 3 of the 5 times. All of the other 75 rows are identical. Is there some setting in my.cnf or php.ini that I need to check - perhaps mysql_always_return_correct_results? I tried echoing the results out directly instead of using number_format(), but there was no change in the numbers. I've never seen anything like this...perhaps I need more coffee? Versions: Apache 1.3.26/php 4.1.2, using mysql client API 3.23.47 MySQL 3.23.47-log Platform: SunOS 5.8 sun4u sparc SUNW,Sun-Fire-280R Thanks in advance, steve -- +------------------------------------------------------------------------+ | Steve Edberg sbedberg@ucdavis.edu | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | +------------------------------------------------------------------------+ | SETI@Home: 1001 Work units on 23 oct 2002 | | 3.152 years CPU time, 3.142 years SETI user... and STILL no aliens... | +------------------------------------------------------------------------+

« previous php.general (#124298) next »