Jump to content


Photo

Find the largest number in a column


  • Please log in to reply
2 replies to this topic

#1 crzyman

crzyman
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 08 September 2005 - 07:52 PM

I need to find out the largest number in a column and I thought this would work. What could I be doing wrong? Thanks for your help.

<?

mysql_connect("localhost","name","pass");

mysql_select_db("MyDatabase");

$result = mysql_query("SELECT MAX(count_visits) FROM artist");

//grab all the content
while($r=mysql_fetch_array($result))
{

$profile_views=$r["count_visits"];

//display the row
echo "<FONT size=2><center><font color=#000000>Profile Views: $profile_views</font></center>";

}
?>

#2 OLG

OLG
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 08 September 2005 - 08:23 PM

it would help if you posted any error message or is it simply not giving the result?
Download Notepad++, the Best IDE for ANY language

#3 crzyman

crzyman
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 09 September 2005 - 01:22 AM

it would help if you posted any error message or is it simply not giving the result?

View Post



It wasn't giving a result. I now have it working. Thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users