Php issue left join

hello every one i have a result that shows only numbers, normally i use this

$query = "SELECT ua.*, sss.team_id, sss.teams AS teams2, ss.team_id, ss.teams AS teams1, s.team_id, s.teams, a.current_bid, a.current_bid_id, a.id, a.team1, a.title, a.team2, a.ends, a.starts, b.bid, b.balance, b.willwin, b.quantity, b.id As bid_id FROM " . $DBPrefix . "bids b
    LEFT JOIN " . $DBPrefix . "useraccounts ua ON (ua.auc_id = b.auction AND ua.user_id = b.bidder)
    LEFT JOIN " . $DBPrefix . "auctions a ON (a.id = b.auction)
    LEFT JOIN " . $DBPrefix . "sports s ON (s.team_id = b.willwin)
    LEFT JOIN " . $DBPrefix . "sports ss ON (ss.team_id = a.team1)
    LEFT JOIN " . $DBPrefix . "sports sss ON (sss.team_id = a.team2)

to display the names relating to the numbers but am stuck on this method of mysql

$join_sql .= " LEFT JOIN " . $DBPrefix . "users u ON (u.id = " . $DBPrefix . "useraccounts.user_id) ";
$pull_sql .= ', u.nick';

$join_sql .= " LEFT JOIN " . $DBPrefix . "auctions a ON (a.id = " . $DBPrefix . "useraccounts.auc_id ) ";
$pull_sql .= ', a.id '; 

$join_sql .= " LEFT JOIN " . $DBPrefix . "sports s ON (s.team_id = " . $DBPrefix . "useraccounts.willwin) ";
$pull_sql .= ', s.team_id';

i dont seem to know how to introduce it to connect to sports table team_id and display it name “teams”, how do i go about it, thanks

What do you do with the $pull_sql variable later on? I noticed that the final thing (in your posted code, there may be more later) doesn’t have a space on the end, so if you concatenate that with something that doesn’t start with a space, you may end up with a syntax error.

I can’t see anything specifically wrong with the second bit of code in isolation. The problem you are having (what is the problem, by the way? Any error messages?) may be related to the earlier parts of the query - could you post that, in case? And an idea of what is going wrong?

The result display this

for auctions table with column

team1 team2
5 …6
6 …3
2 …1
4 … 7

$join_sql .= " LEFT JOIN " . $DBPrefix . "auctions a ON (a.id = " . $DBPrefix . "useraccounts.auc_id ) ";
$pull_sql .= ', a.id ';

in the table columns where are pulled are team1 and team2 so i get result like

it only display numbers which is fine, i dont know how to use this sql to connect to the table

sports where the ids and the names are

column
team_id teams
1 … liver pool
2 … manu
3 … etc
4 … etc
5 …etc
6 … etc
7 … etc

hope u understand what i mean now

ok found the issue out i think

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.