tecdesign Posted April 25, 2006 Share Posted April 25, 2006 [code]while ($i < $l){$query = mysql_query("SELECT max( topicid ) as topicmaxFROM topics");$max_check = mysql_num_rows($query);if($max_check > 0){ while($row = mysql_fetch_array($query)){ foreach( $row AS $key => $val ){ $$key = stripslashes( $val ); }session_register('topicmax');$_SESSION['topicmax'] = $max; }}$maxit = $max - $i;[/code]Ok what I am having trouble with is I want to take max (topicid) from the sql statement and pretty much make $max = max(topicid). Does anyone know how to do this? Link to comment https://forums.phpfreaks.com/topic/8335-trouble-with-max-in-sql/ Share on other sites More sharing options...
Barand Posted April 25, 2006 Share Posted April 25, 2006 [code]$query = mysql_query("SELECT max( topicid ) FROM topics");$max = mysql_result ($query, 0);[/code] Link to comment https://forums.phpfreaks.com/topic/8335-trouble-with-max-in-sql/#findComment-30405 Share on other sites More sharing options...
tecdesign Posted April 25, 2006 Author Share Posted April 25, 2006 Thanks Barand. I am trying to create my own forum. Link to comment https://forums.phpfreaks.com/topic/8335-trouble-with-max-in-sql/#findComment-30406 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.