473,385 Members | 1,518 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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($sql) or print mysql_error(); // line
38
$max_esn = mysql_result($max_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.php 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
sa***@npr.org
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1286

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Sue | last post by:
I'm working on a database that keeps track of employees hired by a general contractor on a project by project basis. These employees are hired to work on a project and are then laid off either at...
1
by: u473 | last post by:
I am scratching my head with the required quotes and parentheses. I started with an existing working Query with Running Total by date. Now I need to produce a running total by quarter day, so I...
14
by: Darin | last post by:
I have a table that I want to delete specific records from based on data in other tables. I'm more familiar with Access '97, but am now using 2003, but the database is in 2000 format. In '97, I...
9
by: Philip Pinkerton | last post by:
When trying to connect to database via the pgAdmin3 GUI it asks for a password. I use the same passworrd as I did when I connect to the DB via command line but I get Ident error? how do I set,...
2
by: jim Bob | last post by:
Hi, I have a query with the criteria of (!..) Or !.. When I provide the value from qmylist, a second pop up appears waiting for the value from lstResults. If I enter nothing and click ok, it...
9
by: JT | last post by:
I am working on a basic webpage in PHP connecting to a mySQL database, here is my query... //query 1 $query_rs_staff = "SELECT * FROM jtStaff WHERE locationID=".$_GET; $rs_staff =...
2
by: Zeljko | last post by:
I'm creating Address book. Header of the main form (frmAddress) contains combo box (cboFilter) to filter records by Occupation on main Form(Ocupation1). That's working. Combo box also have "Show...
6
by: traineeirishprogrammer | last post by:
I am currently working on a project where I need to sort my MYSQL query results by different categories. How ever the code does not seem to be working properly and I spend too much time on it...
11
by: olobraecky | last post by:
Hi all, I am new to perl - just started to learn it a few weeks ago. Basically, what I am trying to do is a "register user" script using a mySQL database. I have managed to do the insert query...
1
by: Tobias | last post by:
Hello, I have a data entry form. When data is entered in one of the fields I would like that data to be used to lookup info in a query and have that displayed in the form. The main form is a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.