Re: problems with a select query in informix
| From: | Martin A. Marques | Date: | Wed, 05 Jul 2000 13:45:14 +0000 |
| Subject: | Re: problems with a select query in informix | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4933@lists.php.net to get a copy of this message | ||
On Wed, 05 Jul 2000, you wrote:
> Interesting! I've had the same problem with mysql on apache/cobalt linux. the
> mysql function max() returned 0 no matter what data was in the table. Locally on
> my Win95/apache/mysql system, everything worked fine. My solution (also very
> ugly and slow but...): I made a loop through all the rows and looked for the max
> value in my php script.
I was looking at the wrong field at the array. Solved it.
Try this
$q_id_identi=ifx_query("SELECT MAX (a_id) FROM articulo",$conn_id);
$q_ar_identi=ifx_fetch_row($q_id_identi,"NEXT");
reset($q_ar_identi);
$llave=key($q_ar_identi);
echo(sprintf("<br> %d %s <br>",$q_ar_identi[$llave],$llave));
The problem was that the key was max and not a_id as I thought.
--
"And I'm happy, because you make me feel good, about me." - Melvin Udall
-----------------------------------------------------------------
Martín Marqués email: martin@math.unl.edu.ar
Santa Fe - Argentina http://math.unl.edu.ar/~martin/
Administrador de sistemas en math.unl.edu.ar
-----------------------------------------------------------------