OK, I am new to PHP, and probably this is an easy answer:
I want to get the max number in a column, then echo that number.
I keep getting errors, and dont know where to begin.
This I know is correct, since I tested it on mysql database:
$q1 = "SELECT max(FENUMBER) from rma ";
$result=mysql_query($q1) or die ("Couldn't execute query Lesley");
This does deliver the maximum number in the column FENUMBER.
I am having problems displaying this. Here is where I am now:
$q1 = "SELECT max(FENUMBER) from rma ";
$result=mysql_query($q1) or die ("Couldn't execute query Lesley");
$row= mysql_fetch_array($result);
extract($row);
echo "$FENUMBER";
Thanks: Lesley
ECHO results of a query
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
You generally want to avoid the usage of extract() in this case. All your columns will be returned as an array in $row.
Try this and post the results please,
Try this and post the results please,
Code: Select all
$row= mysql_fetch_array($result);
//add these two lines
echo '<pre>';
print_r($row);