Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 08-08-2022, 03:46 PM   #1
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,116
Pagination issue (Displaying RLIKE Results)

Could someone possibly point me in the right direction as to why this query isnt showing the results that I want when adding a category but, it allows me to pull the full contents of the database and display them when no WHERE or RLIKE is present?

Quote:
<?php
include('db.php');

if (isset($_GET['page_no']) && $_GET['page_no']!="") {
$page_no = $_GET['page_no'];
} else {
$page_no = 1;
}

$total_records_per_page = 10;
$offset = ($page_no-1) * $total_records_per_page;
$previous_page = $page_no - 1;
$next_page = $page_no + 1;
$adjacents = "2";

$result_count = mysqli_query($con,"SELECT COUNT(*) As total_records FROM `Directory`");
$total_records = mysqli_fetch_array($result_count);
$total_records = $total_records['total_records'];
$total_no_of_pages = ceil($total_records / $total_records_per_page);
$second_last = $total_no_of_pages - 1; // total page minus 1

$result = mysqli_query($con,"SELECT * FROM Directory LIMIT $offset, $total_records_per_page");
while($row = mysqli_fetch_array($result)){

echo "<p align=\"left\" class=\"style2\"><strong><a href=". $link .">". $row['Name'] ."</a></strong>";
echo "<p align=\"left\" class=\"style2\">". $row['Description'] ."</a>";
echo "<br />";

}
mysqli_close($con);
?>
I've tried adding the following to the query itself with no luck:

Quote:
$result = mysqli_query($con,"SELECT * FROM Directory WHERE Category RLIKE catfood LIMIT $offset, $total_records_per_page");
The amount of pages in the pagination changes, it just wont show the data when I add the WHERE Catergory RLIKE catfood part :/

What am I missing please?
__________________
NOTHING TO SEE HERE
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-08-2022, 03:58 PM   #2
Miguel T
♦ Web Developer ♦
 
Miguel T's Avatar
 
Industry Role:
Join Date: May 2005
Location: Full-Stack Developer
Posts: 12,468
RLIKE is for REGEX matches.
You should update the query:

$result = mysqli_query($con,"SELECT * FROM Directory WHERE Category LIKE '%catfood%' LIMIT $offset, $total_records_per_page");
__________________

Full Stack Webdeveloper: HTML5/CSS3, jQuery, AJAX, ElevatedX, NATS, MechBunny, Wordpress
Miguel T is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-08-2022, 05:02 PM   #3
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,116
Quote:
Originally Posted by Miguel T View Post
RLIKE is for REGEX matches.
You should update the query:

$result = mysqli_query($con,"SELECT * FROM Directory WHERE Category LIKE '%catfood%' LIMIT $offset, $total_records_per_page");
*brainfart moment* Thank you
__________________
NOTHING TO SEE HERE
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
rlike, category, query, catfood, pagination, results, adding, mysqli_query$con, select, directory, $result, luck, helpme, limit, missing, pages, add, amount, catergory, $offset, $total_records_per_page;, data, direction, displaying, issue, possibly



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.