Jump to content


Photo

selecting a group from a table of many


  • Please log in to reply
3 replies to this topic

#1 dharm

dharm
  • Members
  • PipPip
  • Member
  • 27 posts

Posted 26 September 2006 - 01:50 PM

Hi, im trying to find a way where I can get the highest profile_id number from a group of profiles owned by a particular user..The table “profiles” also contains other users profile(s). here is the part of the code im workin with:

<?php $query = "Select MAX(profile_no)  from ".$DBprefix."profiles GROUP BY where pro_id='$cid'"; // $cid is the users unique account number. ?>


any help will be much appreciated .. thx!


#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 26 September 2006 - 02:49 PM

<?php $query = "Select profile_no  from ".$DBprefix."profiles where pro_id='$cid' ORDER BY profile_no DESC LIMIT 0,1"; // $cid is the users unique account number. ?>

Does that work????
follow me on twitter @PHPsycho

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 26 September 2006 - 06:02 PM

And what are you getting now?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#4 dharm

dharm
  • Members
  • PipPip
  • Member
  • 27 posts

Posted 26 September 2006 - 11:59 PM

Spot on mate!! thank you!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users