Glese Posted November 28, 2011 Share Posted November 28, 2011 if (isset($select_category) || isset($most_liked)) { // ALL but NO OTHER if (((($select_category == 'All') || (!isset($select_category)))) && (!isset($most_liked))) { $query = "SELECT * FROM con, user WHERE con.user_id = user.user_id ORDER BY contribution_date DESC"; fetch_all ($dbc, $query); // CATEGORY but NOT most_liked } elseif (isset($select_category) && !isset($most_liked)) { $query = "SELECT * FROM con, user WHERE con.user_id = user.user_id AND category = '$select_category' ORDER BY contribution_date DESC"; fetch_all ($dbc, $query); // CATEGORY and MOST_LIKED } elseif (($select_category != 'All') && (isset($select_category) && isset($most_liked))) { $query = "SELECT * FROM con, user WHERE con.user_id = user.user_id AND category = '$select_category' ORDER BY likes DESC"; fetch_all ($dbc, $query); // ALL or NO CATEGORY but MOST LIKED } elseif ((($select_category == 'All') || (!isset($select_category))) && (isset($most_liked))) { $query = "SELECT * FROM con, user WHERE con.user_id = user.user_id ORDER BY likes DESC"; fetch_all ($dbc, $query); } } What I am basically trying to accomplish is, choose a category through a drop down list, select that category and then go through all the rows in the database and print the content out. As of now it is working for me, I am also using a pagination script to print out everything in a table. The problem I am having is that fetch_all function is also printing the query out together with the content. Any ideas why it does that? Did I use this function the right way? If you need more information let me know. Quote Link to comment https://forums.phpfreaks.com/topic/251948-is-this-a-proper-use-of-fetch_all-or-is-there-an-alternative/ Share on other sites More sharing options...
trq Posted November 28, 2011 Share Posted November 28, 2011 How should we know? fetch_all() is not a built in php function. Quote Link to comment https://forums.phpfreaks.com/topic/251948-is-this-a-proper-use-of-fetch_all-or-is-there-an-alternative/#findComment-1291782 Share on other sites More sharing options...
Glese Posted November 28, 2011 Author Share Posted November 28, 2011 lol I confused it with mysqli_fetch_all(), wait a minute, I am working on an older project and got a confused for a bit, I will rework the code a bit and then I'll post the pagination with the fetch_all function. Quote Link to comment https://forums.phpfreaks.com/topic/251948-is-this-a-proper-use-of-fetch_all-or-is-there-an-alternative/#findComment-1291784 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.