Hello My Problem May Be Very Easy Or Very Hard

Iam Still Noob In Php

I Developed This Site

http://www.e-alriyadh.com/

The Pagination Works Fine In The Index Page

Like This

http://www.e-alriyadh.com/index.php?p=2

Now There's A Problem In The Category Section Pagination

This Is A Section

http://www.e-alriyadh.com/cat.php?id=22

When I Try To Go To Page 2

It Must Be Like This

http://www.e-alriyadh.com/cat.php?id=22&p=2

Instead Of This

http://www.e-alriyadh.com/cat.php?p=2

I Found In My Pagination Class File This ( Variable ) var $querystring = ''; // example id=1&e=2&r=5 // When I Make It Like This var $querystring = 'id=?????'; // example id=1&e=2&r=5 // Now My Problem How Can I Make The Class Get The ID

I Attached The

Index.php
cat.php
split.php (( Pagination Class ))

I Know I have Many Problems In My Develope Coz Iam Not Expert

But I Wish To Solve This Problem

How about:

$categoryId = 22;

$split = new page_split;
$split->querystring = "id={$categoryId}";

// The call the other page_split functions afterwards...

R.

How about:

$categoryId = 22;

$split = new page_split;
$split->querystring = "id={$categoryId}";

// The call the other page_split functions afterwards...

R.

Is This Work For All Categories ??

I need To make It Work For All Categories Not Just Id 22

When the category page loads, get the id and set the querystring variable of the pagination class. E.g:

<?php // cat.php

$categoryId = (int)$_GET['id'];

$split = new page_split;
$split->querystring = "id={$categoryId}";

// Perform the rest of the page functionality...

Does that make sense?

R.

commented: Thanks So Much :) Solved +1

This Is The Full Code

Could You Plz Tell me Where To Put Your Code

Or If U Can Edit It Plz

<?php

include('func.php');

$id = intval($_GET["id"]);
$Sql2 = mysql_query("select id,name from ads_cat where id='$id'");
$Row2 = @mysql_fetch_array($Sql2);
if (!$Row2)
{
Echo "<meta http-equiv='Refresh' content='0;URL=Error.php'>";
exit;
}

$headers = headers("tabs.html");
$headers = str_replace("{menu}",menu(),$headers);

echo $headers;

?>

<div class="content"> 
<br/>
<?php

require_once 'split.php';

$split = new page_spilt("SELECT `id`,`title`,`full` FROM `ads` where cat='$id' AND active='0' 

ORDER BY `id` DESC", $_GET["p"]);
$rs = $split->get_results();
if (is_array($rs)) {
    foreach ($rs as $key => $value) {
echo "<div style='width: 186px; height: 174px; float:right; background: transparent url

(Zimg/Box.A.Png) no-repeat; padding: 0 4.5px 10px 0px'>"; 
echo "<table width='98%' border='0'>";
echo "<tr>";
echo "<td class='x1'>" . $rs[$key][1] . "</td>";
echo "</tr>";
echo  "<tr>";
echo "<td class='x2'>" . $rs[$key][2] . "</td>";
echo "</tr>";
echo "<tr>
<td><a class='x3' target='_blank' href='details.php?id=". $rs[$key][0]."'>تفاصيل</a>
</td>
</tr>";
echo "</table>";
echo "</div>";
    }

?>

Thank You So Much I Got It

The Code Should Be Like This

<?php

require_once 'split.php';

$split = new page_spilt("SELECT `id`,`title`,`full` FROM `ads` where cat='$id' AND active='0' 

ORDER BY `id` DESC", $_GET["Page"]);
$split->querystring = "id=$id"; 
$rs = $split->get_results();
if (is_array($rs)) {
    foreach ($rs as $key => $value) {
echo "<div style='width: 186px; height: 174px; float:right; background: transparent url

(Zimg/Box.A.Png) no-repeat; padding: 0 4.5px 10px 0px'>"; 
echo "<table width='98%' border='0'>";
echo "<tr>";
echo "<td class='x1'>" . $rs[$key][1] . "</td>";
echo "</tr>";
echo  "<tr>";
echo "<td class='x2'>" . $rs[$key][2] . "</td>";
echo "</tr>";
echo "<tr>
<td><a class='x3' target='_blank' href='details.php?id=". $rs[$key][0]."'>تفاصيل</a>
</td>
</tr>";
echo "</table>";
echo "</div>";
    }

?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.