Why is this query not working?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Susan Ator

    Why is this query not working?

    I am running php 4.2.2 and mysql 3.23.54.

    This is my query:

    $sql = "SELECT MAX(esn) FROM address"; // line 37
    $max_esn_result = mysql_query($sq l) or print mysql_error(); // line
    38
    $max_esn = mysql_result($m ax_esn_result,$ i,"esn"); // line 39

    This is the error I get:

    esn not found in MySQL result index 5 in
    /var/www/html/address_entry.p hp on line 39

    This is the structure of the address table:

    `address_id` int( 11 ) NOT NULL auto_increment,
    `address` varchar( 12 ) default NULL ,
    `esn` int( 10 ) default NULL ,
    `noi` varchar( 80 ) default NULL ,
    `owner` varchar( 80 ) default NULL ,
    `description` varchar( 80 ) default NULL ,
    `operator` varchar( 20 ) default NULL ,
    `timestamp` varchar( 20 ) default NULL ,
    `addresslist` text,
    PRIMARY KEY ( `address_id` )
    ) TYPE = MYISAM AUTO_INCREMENT = 601;

    When I run:

    SELECT MAX(esn) FROM address

    in phpMyAdmin I get the expected result which is 515.

    What in the world am I missing?!?!?!
    Susan Ator
    Online Services Engineer
    National Public Radio
    Distribution Division
    sator@npr.org


    --
    MySQL General Mailing List
    For list archives: http://lists.mysql.com/mysql
    To unsubscribe: http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw

Working...