Hi there,
I posted about this a while ago but it was a slightly different problem... I have approached it a different way and am still having issues. π If someone could help me out I would forever be indebted.
I want to pull out the highest article # according to author, depending upon department.
When I use this below and query the db, this works:
$sql = "SELECT max(Articles.ar_id), Articles.ar_author
FROM Articles
WHERE Articles.ar_dept = $dept
GROUP BY Articles.ar_author";
$sqlResult = mysql_query($sql);
Now, what I want to do is take the max(Articles.ar_id) and convert it to a variable, so I can query the db again in order to get other information out (Articles.ar_article, Articles.ar_title)
But, I cannot figure out how to get the article # from max(Articles.ar_id)
I tried pulling it out of $sqlResult using mysql_fetch_array and mysql_fetch_object but both times I get a blank variable for $maxArticleID. This is the code:
while ($articleRow = mysql_fetch_array($sqlResult)) {
$maxArticleID = $articleRow["Articles.ar_id"];
print($maxArticleID);
}
Why is it coming up blank? Am I doing this all wrong?