Tutorials
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOtherTutorials

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 29th, 2003, 02:43 PM
trippleweb's Avatar
trippleweb trippleweb is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Victoria, BC, Canada
Posts: 702 trippleweb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 25 m 54 sec
Reputation Power: 2
Next and Previous links

I have spent some time to solve the following problem, any thoughts?

I have a page that views single rows, and I want to use Matt's Prev and Next Tutorial for the bottom.

When I enter the page you will click on editgorge.php?TransactionNo$

It will then send you to the following php file:

editgorge.php:
--------------------
<?php
include("../dogs.php");
$connection = mysql_connect($host, $user, $password)
or die ("Couldn't connect to server.");

$db = mysql_select_db ($database, $connection)
or die ("Couldn't connect to database.");

$query="SELECT * FROM gorgeCalls WHERE TransactionNo='$TransactionNo'";
$result = mysql_query($query)
or die("Couldn't execute query.");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
extract($row);
Include "editgorge.inc";
?>

editgorge.inc:
-------------------
<html>
<head><title>Update Client Profile</title>
<style type="text/css">
<!--
INPUT { background-color: #cccccc; }

-->
</style>

</head><html>
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
<font face="helvetica,arial">
<center>
<table>
<tr><td>
<img src="../images/dfxonline.gif"></a>
</td><td>
<form action="updategorge.php" method="post">
<table border=0>
<tr valign=top><td>
<table border="0" cellspacing="0">
<tr><td align="right"><b>Transaction No.</b></td>
<td><input type="text" name="TransactionNo"
value="<?php echo $TransactionNo ?>"
size="20" maxlength="20" READONLY></td></tr>
<tr><td align="right"><b>Login Name</b></td>
<td><input type="text" name="logname"
value="<?php echo $logname ?>"
size="20" .....
..........etc)
-----------------

Now I would like to add Matt's code at the bottom, my problems is I want to link from a certain TransactionNo first. Help please, I am still a php newbie. Also I only want to view one row at a time.
Thanks

Matt's Prev next code:
------------------------

<?PHP
if(!isset($start)) $start = 0;

$query = "SELECT * FROM table LIMIT " . $start . ", 10";
//do database connection
$result = mysql_query($query); //you should do error checking
//display data

//this code was wrong, I did not have the second query. Thanks to Plaggy Pig.
// need another query to get the total amount of rows in our table
$query = "SELECT count(*) as count FROM table";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$numrows = $row['count'];
if($start > 0)
echo "<a href="" . $PHP_SELF . "?start=" . ($start - 10) .
"">Previous</a><BR>n";
if($numrows > ($start + 10))
echo "<a href="" . $PHP_SELF . "?start=" . ($start + 10) .
"">Next</a><BR>n";
?>

Reply With Quote
  #2  
Old August 29th, 2003, 04:05 PM
trippleweb's Avatar
trippleweb trippleweb is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Victoria, BC, Canada
Posts: 702 trippleweb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 25 m 54 sec
Reputation Power: 2
RE: Next and Previous links

I have updated the code to this and it works but.....
I still need to take care of when someone links on the TransactionNo, that individual row appears first, does this meke sense?


<html>
<head><title>Update Client Profile</title>
<style type="text/css">
<!--
INPUT { background-color: #cccccc; }

-->
</style>

</head><html>
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
<font face="helvetica,arial">
<center>
<table>
<tr><td>
<img src="../images/dfxonline.gif"></a>
</td><td>
<form action="updategorge.php" method="post">
<table border=0>
<?PHP
include("../dogs.php");
$connection = mysql_connect($host, $user, $password)
or die ("Couldn't connect to server.");

$db = mysql_select_db ($database, $connection)
or die ("Couldn't connect to database.");

if(!isset($start)) $start = 0;

$query = "SELECT * FROM gorgeCalls ORDER BY TransactionNo LIMIT " . $start . ", 1";
//do database connection
$result = mysql_query($query); //you should do error checking
//display data
while($myrow = mysql_fetch_array($result))
{
echo "<tr valign=top><td>
<table border='0' cellspacing='0'>
<tr><td align='right'><b>Transaction No.</b></td>
<td><input type='text' name='TransactionNo'
value='";
echo $myrow["TransactionNo"];
echo "'size='20' maxlength='20' READONLY></td></tr>
<tr><td align='right'><b>Login Name</b></td>
<td><input type='text' name='logname'
value='";
echo $myrow["logname"];
echo "'size='20' maxlength='20' READONLY></td></tr>
<tr><td align='right'><b>Date/Time</b></td>
<td><input type='text' name='timeStamp'
value='";
echo $myrow["timestamp"];
echo "'size='20' maxlength='20' READONLY></td></tr>";


}
echo "</table>";



//this code was wrong, I did not have the second query. Thanks to Plaggy Pig.
// need another query to get the total amount of rows in our table
$query = "SELECT count(*) as count FROM gorgeCalls";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$numrows = $row['count'];
if($start > 0)
echo "<a href="" . $PHP_SELF . "?start=" . ($start - 1) .
"">Previous</a><BR>n";
if($numrows > ($start + 1))
echo "<a href="" . $PHP_SELF . "?start=" . ($start + 1) .
"">Next</a><BR>n";
?>



Reply With Quote
  #3  
Old August 31st, 2003, 10:21 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Next and Previous links


Reply With Quote
Reply

Viewing: Codewalkers ForumsOtherTutorials > Next and Previous links


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway