I'm developing a reverse auction style site and have the following code.
Code: Select all
$result = mysql_query("SELECT proposal.*,SYSDATE(),count(bid.proposalid) AS bids, TIME_FORMAT(TIMEDIFF(tomorrowtime, SYSDATE()), '%H hours, %i minutes') AS timeleft
FROM proposal
JOIN bid ON proposal.proposalid = bid.proposalid
WHERE NOW() < proposal.tomorrowtime AND proposal.username = '$username'
GROUP BY bid.proposalid
");
Now the problem is that it only ever prints one record (one user proposal) to the screen, even if there is more than one user proposal.
This problem is rectified when i remove the
Code: Select all
count(bid.proposalid) AS bids
Code: Select all
GROUP BY bid.proposalid
However I'm then left without the critical information of how many bids are made on each proposal.
I was just wondering if anyone can suggest an alternative way of counting the amount of bids made??
Any suggestions would be really apprecaited!!
Many Thanks