Hi all,
I'm developing a reverse auction style site and have the following code.
$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
");
This code returns a series of information about a user proposal which I echo to the screen.
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
count(bid.proposalid) AS bids
and
GROUP BY bid.proposalid
parts of the statement.
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