MySQL Forums
Forum List  »  PHP

Re: Please Explain this PHP/MySQL Query
Posted by: Peter Brawley
Date: November 05, 2021 06:10PM

> The error is the 404 I posted

If that error is from MySQL, which I doubt, it means "The cloud file provider exited unexpectedly", which is not a MySQL query error.

A likely cause of the error is that you failed to quote the reference to the query parameter =, which is a string value so it must be enclosed in quotes ... WHERE users.user_name = '%s'".

If that's not the error cause, and if the query induces a MySQL error, you need to find out what that is ...

$qry = 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'])) ;

$res = $db->query($qry );
if( !$res ) exit( $db->error );
else echo "rows=", $res->num_rows

> not sure what the 6 tables are?

?! The six tables referenced in your query.

Options: ReplyQuote


Subject
Written By
Posted
Re: Please Explain this PHP/MySQL Query
November 05, 2021 06:10PM


Sorry, you can't reply to this topic. It has been closed.

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.