Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Fatal error: Call to a member function fetch_assoc() on a non-object in D:xampphtdocsSuperfacil_v1.2.8.9incclass_search.php on line 32
- $smtp_category_cc = "SELECT count(*) as total FROM public_ads WHERE $construct";
- $smtp_category_qry_cc = $con->query($smtp_category_cc);
- $total_request = $smtp_category_qry_cc->fetch_assoc();
- $name = mysqli_real_escape_string($con, sanitize($_GET['search']));
- $category = mysqli_real_escape_string($con, sanitize($_GET['category']));
- $x = 0;
- $q = str_replace(array("\",";"), "", $name); // remove ALL backslashes & remove ALL ";" -> for sql security: no (simple) injection of commands
- $q = trim($q);
- $search_exploded = explode(" ", $q);
- foreach($search_exploded as $search_each ) {
- $x++;
- $construct = " ";
- if($x == 1) {
- $construct .= "ads_title LIKE '%$search_each%' AND category_id = '$category' AND ads_active = 1 AND ads_end = 0";
- } else {
- $construct .= "AND ads_brand LIKE '%$search_each%' AND category_id = '$category' AND ads_active = 1 AND ads_end = 0";
- }
- }
- /**************************/
- $smtp_category_cc = "SELECT count(*) as total FROM public_ads WHERE $construct";
- $smtp_category_qry_cc = $con->query($smtp_category_cc);
- $total_request = $smtp_category_qry_cc->fetch_assoc();
- echo '<p class="shop-results">Encontrados <span class="badge">'. $total_request['total'] .'</span> <strong>Anúncios</strong>. </p>';
- /**************************/
- $get_search = "SELECT ads_id, client_id, category_id, ads_title, ads_brand, ads_content, ads_price, ads_views, ads_image_1, ads_image_2, ads_image_3, ads_date FROM public_ads WHERE $construct";
- $get_search_qry = $con->query($get_search);
- if($get_search_qry->num_rows > 0) {
Add Comment
Please, Sign In to add comment