MySQL Forums
Forum List  »  PHP

Please Explain this PHP/MySQL Query
Posted by: Raymond Jender
Date: November 05, 2021 08:37AM

As I am not an expert in either PHP or MySQL, could someone please explain this query as it is failing the get_profile->num_rows check. Thanks and I appreciate it.

$get_profile = $db->query(sprintf("SELECT users.*, picture_photo.source as user_picture_full, picture_photo_post.privacy as user_picture_privacy, cover_photo.source as user_cover_full, cover_photo_post.privacy as cover_photo_privacy, packages.name as package_name, packages.color as package_color FROM users LEFT JOIN posts_photos as picture_photo ON users.user_picture_id = picture_photo.photo_id LEFT JOIN posts as picture_photo_post ON picture_photo.post_id = picture_photo_post.post_id LEFT JOIN posts_photos as cover_photo ON users.user_cover_id = cover_photo.photo_id LEFT JOIN posts as cover_photo_post ON cover_photo.post_id = cover_photo_post.post_id LEFT JOIN packages ON users.user_subscribed = '1' AND users.user_package = packages.package_id WHERE users.user_name = %s", secure($_GET['username']))) or _error("SQL_ERROR_THROWEN");


if($get_profile->num_rows == 0) {
_error(404);

Options: ReplyQuote


Subject
Written By
Posted
Please Explain this PHP/MySQL Query
November 05, 2021 08:37AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.