Thank you. Changing it to:
$max_esn = mysql_result($max_esn_result,$i);
did the trick.
sa
-----Original Message-----
From: Jennifer Goodie [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 23, 2003 6:33 PM
To: Susan Ator; [EMAIL PROTECTED]
Subject: RE: Why is this query not working?
> I am running php 4.2.2 and mysql 3.23.54.
This is a PHP question, not mySQL.
> This is my query:
>
> $sql = "SELECT MAX(esn) FROM address"; // line 37
> $max_esn_result = mysql_query($sql) or print mysql_error(); // line
> 38
> $max_esn = mysql_result($max_esn_result,$i,"esn"); // line 39
What is the value of $i? Are you sure you want to jump to row $i of your
result set?
>
> This is the error I get:
>
> esn not found in MySQL result index 5 in
> /var/www/html/address_entry.php on line 39
>
I think since you are selecting MAX(esn) is doesn't get returned as esn, it
gets returned as MAX(esn), I could be wrong. A simple fix would be to get
rid of the third argument you are passing to mysql_result since your query
is only returning one field you do not need an offset or name. Or you can
change the query to "SELECT MAX(esn) as max_esn FROM address"; and then use
max_esn as your offset/fieldname.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]