Left Join not working (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


iany -> Left Join not working (11/4/2005 3:47:25)

One of my left joins is not working.
Here is query
$ql="SELECT profiles.keywords,profiles.profile,profiles.user_id, profiles.location, profiles.industrysector,industrysector.*, jobcategory.*, locations.* FROM profiles LEFT JOIN industrysector ON profiles.industrysector = industrysector.industrysectorcode LEFT JOIN jobcategory ON profiles.jobcategory = jobcategory.jobcategorynumber LEFT JOIN locations ON profiles.location = locations.locationnumber WHERE profiles.user_id=$user_id";
$result=mysql_query($ql);

// Fetch and print all the records.
//while
$row = mysql_fetch_array($result, MYSQL_ASSOC)

First two joins work fine but third returns the number not the category.

Now as there is a wild card entry using '%' I am using the following condition:

<?php If ($location =='%') {
//Print ANY
print 'Any';
}
else print $row['location'];

?>

Any thoughts?





Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625