mysql - Query not outputting all relevant results from database -
i trying output relevant values database using code below. reason, information not output should be, , don't know why.
i'm guessing there wrong query?
$result = mysql_query( "select tbl_status.id statid, tbl_status.from_user statfrom, tbl_status.status statstatus, tbl_status.deleted statdel, tbl_status.date statdate, tbl_users.id usrid, tbl_users.name usrname, tbl_photos.profile photosprofile, tbl_photos.photo_link photolink, tbl_photos.default_photo photodefault tbl_status inner join tbl_users on tbl_status.from_user = tbl_users.id inner join tbl_photos on tbl_photos.profile = tbl_users.id tbl_status.deleted = '0' , tbl_photos.default_photo = '1' order tbl_status.date desc; ");
based on query, here 4 possible reasons you're not seeing statuses:
- you're using inner join
tbl_photos
, user doesn't have photo excluded. - you're using inner join
tbl_users
, status doesn't relate @ least 1 user (and user must have photo - see #1) excluded. - you're filtering on
tbl_photos.default_photo = '1'
, phototbl_photos.default_photo <> '1'
excluded. because of inner joins, exclude associated user , possibly exclude associated status. - you're filtering on
tbl_status.deleted = '0'
, statusdelete <> '0'
excluded. obvious, worth mentioning.
try this: change inner join tbl_users
left join tbl_users
, , change inner join tbl_photos
left join tbl_photos
. if doesn't give results expect, please post sample data , expected results.
Comments
Post a Comment