lasha Posted March 22, 2014 Share Posted March 22, 2014 Hello all This code below works but doesn't filter records by owner. Please help. thanks SELECT * FROM books LEFT JOIN car ON books.car_id = car.id LEFT JOIN cat ON books.cat_id = cat.id WHERE books.owner = '$owner' Quote Link to comment https://forums.phpfreaks.com/topic/287172-left-join-doesnt-work-correctly/ Share on other sites More sharing options...
Barand Posted March 22, 2014 Share Posted March 22, 2014 Have you tried echoing the query string to check it is submitting what you think it's submitting? Have you checked $owner has a value? Have you checked if mysqli_error() returns a message? Quote Link to comment https://forums.phpfreaks.com/topic/287172-left-join-doesnt-work-correctly/#findComment-1473519 Share on other sites More sharing options...
lasha Posted March 23, 2014 Author Share Posted March 23, 2014 (edited) Thanks for answer There is 2 owners, and when owner1 is logged in it does filter and shows only owner1 records. But when owner2 - it shows all result for owner1 and owner2 Yes i tried everything what you suggest and all is ok Edited March 23, 2014 by lasha Quote Link to comment https://forums.phpfreaks.com/topic/287172-left-join-doesnt-work-correctly/#findComment-1473597 Share on other sites More sharing options...
Barand Posted March 23, 2014 Share Posted March 23, 2014 http://uk3.php.net/manual/en/mysqli.error.php Quote Link to comment https://forums.phpfreaks.com/topic/287172-left-join-doesnt-work-correctly/#findComment-1473606 Share on other sites More sharing options...
Solution lasha Posted March 23, 2014 Author Solution Share Posted March 23, 2014 Ok i dont know what was problem, but i deleted records in db and insert it again and now works fine. i think db records were broken or something. Anyway, thank you very much Barand Quote Link to comment https://forums.phpfreaks.com/topic/287172-left-join-doesnt-work-correctly/#findComment-1473610 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.