Iam Using This Code

$result = mysql_query("SELECT games.*,
console.name AS gconsole , 
genre.name AS ggenre ,
company.name as gcompany,
status.name as gstatus 
from games as games
left join console  on  (games.console = console.id)
left join genre  on (games.genre = genre.id)
left join company  on (games.company = company.id) 
left join status  on  (games.status = status.id)");

I Need To Add To It

where id='$id'

Where To Add This ?

Recommended Answers

All 5 Replies

$result = mysql_query("SELECT games.*,
console.name AS gconsole , 
genre.name AS ggenre ,
company.name as gcompany,
status.name as gstatus 
from games as games
left join console  on  (games.console = console.id)
left join genre  on (games.genre = genre.id)
left join company  on (games.company = company.id) 
left join status  on  (games.status = status.id)");

last line before ");

left join status  on  (games.status = status.id) where id='$id' ");
$result = mysql_query("SELECT games.*,
console.name AS gconsole , 
genre.name AS ggenre ,
company.name as gcompany,
status.name as gstatus 
from games as games
left join console  on  (games.console = console.id)
left join genre  on (games.genre = genre.id)
left join company  on (games.company = company.id) 
left join status  on  (games.status = status.id)");

last line before ");

left join status  on  (games.status = status.id) where id='$id' ");

I Got This Error

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\G\GameDetails.php on line 45

And The Line 45 Contain

while($row = mysql_fetch_array($result))

You are in a left join statement I don't think this is a WHERE statement problem.

You are in a left join statement I don't think this is a WHERE statement problem.

Then Why This Error Show ?

The Solution Is

$result = mysql_query("SELECT games.*,
    console.name AS gconsole ,
    genre.name AS ggenre ,
    company.name as gcompany,
    status.name as gstatus
    from games as games
    left join console on (games.console = console.id)
    left join genre on (games.genre = genre.id)
    left join company on (games.company = company.id)
    left join status on (games.status = status.id)WHERE games.id='$id'");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.