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-22-2022, 01:25 PM   #1
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
Pagination & full SQL query question.

So I have this working for a general pagination on a page of links:

Quote:
<?php

$con=mysqli_connect("localhost","user","db","pass" );

$limit = 6; //entries per page.
// default is 1
if (isset($_GET["page"])) {
$page = $_GET["page"];
}
else { $page=1;
}
//determine the results on the displaying page
$page_index = ($page-1) * $limit; // 0

$Links=mysqli_query($con,"select * from Pornsites limit $page_index, $limit");
while($row=mysqli_fetch_array($Links))
{
echo "<table style=\"width: 100%\" align=\"center\">";
echo "<tr>";
echo "<td class=\"style1\">";
echo "<table style=\"width: 95%\" align=\"center\" class=\"style3\" cellpadding=\"3\">";
echo "<tr>";
echo "<td style=\"width: 240px\">";
echo "<a href=". $link .">";
echo "<img src=". $row['Image'] ." alt=\"". $row['Snippet'] ."\" title=\"". $row['Title'] ."\" style=\"width: 190px; height: 120px border: 2px\"></td>";
echo "<td></td>";
echo "<td style=\"width: 700px\" class=\"style1\">";
echo "<h3 class=\"style2\"><a href=". $link .">". $row['Title'] ."</h3></a>";
echo "<p class=\"style2\">". $row['Snippet'] ."</a>";
echo "<br /><p class=\"style5\">". $row['Date'] ." - ". $row['Type'] ."</p></td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
echo "</table>";
}
$all_data=mysqli_query($con,"select count(*) from Pornsites");
$link_count = mysqli_fetch_row($all_data); // say total count 9
$total_records = $link_count[0]; //9
$total_pages = ceil($total_records / $limit); // 9/3= 3
if($page >= 2){
echo "<br /><br /><a href='home.php?page=".($page-1)."' class='btn
customBtn2'>PREVIOUS</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
}

if($page<$total_pages) {
echo "<a href='home.php?page=".($page+1)."' class='btn customBtn2'>LOAD MORE...</a>";
}
?>
But I'm running into issues when I try to be more specific about the types of link I want to display on other pages, specifically, using the following SQL query:

Quote:
"SELECT * FROM Pornsites WHERE Category REGEXP 'teen|teenage' AND Type REGEXP 'paysite' ORDER BY ID DESC;
I've tried the code above in both lines in bold in the code, and it throws a 500 error, what am I doing wrong please? Do I need to use a different query to what I am using?
__________________
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-22-2022, 04:49 PM   #2
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
I found the issue, I had some random white space in the code where I had edited it and copied into the page.
__________________
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-22-2022, 10:00 PM   #3
natkejs
Confirmed User
 
Industry Role:
Join Date: Jan 2003
Location: Nomad Land
Posts: 1,602
Why are you using REGEX to compare the columns?

You might want to read up a bit on the basics of database normalization.

https://www.sqlshack.com/what-is-dat...in-sql-server/
__________________
natkejs 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
pagination, links, page, sql, query, question



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.