473,668 Members | 2,577 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem in hyperlink of pagination.

34 New Member
I am using php version 4.3.3.
The below was my pagination code.
My problem is that when i run this code in my computer, i wall fail because of the hyperlink of the pagination not function when i click it. But when i run in other people computer, It was no problem at all. I wonder to know what wrong to my coding . Is it different version of php also reflect the output?
[php]
<?

//required file for database connection
require("config .php");

$query = "SELECT ID,Name FROM listofitem ";

$result = mysql_query($qu ery);

$page_name="lis t.php";

$num_record = mysql_num_rows( $result);

$display =5;
$XX = 'Sorry, no results were found!';
// If there are no records then startrow
// is 0
if (empty($startro w)) {
$startrow=0;
}

$query2 = "SELECT ID,Name FROM listofitem LIMIT $startrow, $display";

$result2 = mysql_query($qu ery2);

echo "<table border='1'align =center>

<th bgcolor='#CCCFF F' align=left><fon t face='arial,ver dana,helvetica' size='2'><br>Na me</font></th>


$counter = 0;

while(list($ID, $Name) = mysql_fetch_arr ay($result2)) {

if ($counter == 3) {


$counter = 0;
}

echo"<td><font face='arial,ver dana,helvetica' size='2'><a href='Informati onPage.php?id={ $ID}'>{$Name}</a></font></td>";


echo"</tr>";


$counter = $counter + 1;
}
// End loop
// Calculate the previous results, only
// print 'Previous' if startrow is not equa
// l to zero
if ($startrow != 0) {
$prevrow = $startrow - $display;
echo"<a href='$page_nam e?startrow=$pre vrow'>prev</a> ";
}
// Calculate the total number of pages
$pages = intval($num_rec ord / $display);


if ($num_record % $display) {

$pages++;
}
// Print the next pages, first check if
// there are more pages then 1
if ($pages > 1) {
for ($i=1; $i <= $pages; $i++) { // Begin loop
$nextrow = $display * ($i - 1);
echo"<a href='$page_nam e?startrow=$nex trow'>[$i]</a> ";
}
}
//End loop
// Check if we are at the last page, if
// so, dont print 'Next'
if (!(($startrow / $display) == $pages) && $pages != 1) {
// not the last page so print 'Next'
$nextrow = $startrow + $display;
echo"<a href='$page_nam e?startrow=$nex trow'>next</a>";
}
// If there are no results at all
if ($num_record < 1) {
echo"<table border=0 width=795><tr>< td>$XX</td></tr></table>";
echo"</table>";
echo"<br><br><b r><a href='index.php ? '>[back]</a>";
}
?>
[/php]
Nov 3 '06 #1
0 1454

Sign in to post your reply or Sign up for a free account.

Similar topics

9
3397
by: Sharif T. Karim | last post by:
Anyone know of a up-to-date tutorial for pagination where I can have it like: Prev 1 2 3 4 Next Thanks. -- Sharif T. Karim ....you don't know wrath yet...
3
2075
by: redneck_kiwi | last post by:
Hi all: I have a really weird problem. I am developing a customer catalog system for my company and as such have delved into sessions for authentication and access levels. So far, I have managed to get a working system just about finished. I am building an interface for our customer service folks to use to manage registered customers and am seeing some weird behavior.
4
1319
by: Fernando Chilvarguer | last post by:
Hi, I've been trying to figure this one out for a while and I'm stalled. Here's my scenario: - a Parent window with a datagrid on it. The datagrid has pagination enabled and has an "Edit" link for each record. - Once someone clicks on the "Edit" link, a child window pops-up. The user edits the data and submits the form. All the server code is executed and
2
2315
by: Chris H | last post by:
I am having a problem with pagination, basically the problem is happening in the "PREV / NUMBERS / NEXT" links, it appears as if the reason is becasue the increment and decrement operators aren't functioning or the $page variable isnt working in that part of the code... Below is the link to the working but broken page.. as well as the main part of my code... Hopefully someone can explain why the operators arent working or maybe see what i...
11
2765
by: ste | last post by:
Hi there, Further to my recent posts where I've received excellent help from Rik and Jerry, I've ended up with an image gallery on my website that displays images in a table, 3 images per row. This works great and opens all images in the database when I open the url mywebsite/gallery.php, or I can choose certain images (by category) by going to url's like mywebsite/gallery.php?category=landscape Although the above worked perfectly...
4
2179
by: comp.lang.php | last post by:
'll try to explain this as clearly as possible, sorry if it's unclear. You have in your directory /foo 42 images You have in your database metadata for 30 out of those 42 images You have to display all 42 images in the /foo directory whether they have database metadata or not. If any of the 42 images have metadata, you must display the metadata,
1
1508
by: sales | last post by:
Sorry, a real simple question and maybe one not for this group. Have just tried a php pagination tutorial which works fine. The line that produces the "Previous" hyperlink is as below and this works fine. But... echo "<a href=" . $_SERVER . "?start=" . ($start- $records_per_page) . ">Previous Page</a>"; When I try to change the hyperlink properties in the html code to
3
1320
oll3i
by: oll3i | last post by:
echo "<div id=\"join\">"; echo "<div id=\"main\">"; echo "<div id=\"contents\">"; echo "<div id=\"left_strip\">"; echo "<div id=\"content_table\">"; content here echo "</div>";
0
2912
by: George Ter-Saakov | last post by:
Trying to quickly create paginated grid. So i am using ListView. Unfortunatelly pagination works a little strange. Pagination control appears correctly. But when i click "2" page postback happens but current page is still first page. Then i click "3" page. Postback happens but current page is now "2" page. Then i click "4" page and again postback happens and page 3 becomes current. Why is that? How to make it work?
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8367
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2781
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.