almightyegg Posted September 4, 2007 Share Posted September 4, 2007 $f1 = mysql_query("SELECT MAX(id) FROM topics WHERE fid = '$f'"); $f2 = $f1+1; now, I can't see any errors...but when I ran my code $f2 should have equalled 4, but somehow it came out with 12???? what's wrong with it?? Quote Link to comment https://forums.phpfreaks.com/topic/67930-solved-select-max-help/ Share on other sites More sharing options...
The Little Guy Posted September 4, 2007 Share Posted September 4, 2007 Try this: <?php $f1 = mysql_query("SELECT MAX(id) as id FROM topics WHERE fid = '$f'"); $row = mysql_fetch_array($f1); $f2 = $row['id']+1; ?> Quote Link to comment https://forums.phpfreaks.com/topic/67930-solved-select-max-help/#findComment-341444 Share on other sites More sharing options...
almightyegg Posted September 4, 2007 Author Share Posted September 4, 2007 perfect, great thanks Quote Link to comment https://forums.phpfreaks.com/topic/67930-solved-select-max-help/#findComment-341449 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.