RE: [PHP-DB] Link for next db record
| From: | Beau Lebens | Date: | Mon, 13 May 2002 06:40:33 +0000 |
| Subject: | RE: [PHP-DB] Link for next db record | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19150@lists.php.net to get a copy of this message | ||
How are you setting the value for $row["rv_space"] ?
// -----Original Message-----
// From: Jennifer Downey [mailto:jendowney@attbi.com]
// Sent: Monday, 13 May 2002 2:01 PM
// To: php-db@lists.php.net
// Subject: Re: [PHP-DB] Link for next db record
//
//
// Hi Beau,
//
// I have a form that selects an rv electric record here is a
// snip and if you
// need more tell me.
// This just returns a blank page.
//
// $current_date = date("M");
// $pkwh =.064;
// $get_electric = "SELECT * FROM electric WHERE rv_space =
// $row[rv_space]";
// $result = mysql_query($get_electric) or die(mysql_error());
// $row = mysql_fetch_array($result);
// $tot_used = $row[end] - $row[begin];
// $ppkwh = .064;
// $sub_total = $tot_used * $ppkwh;
// $puf = '11';
// $total = $sub_total + $puf;
// echo "<h1><center>Salmon Shores RV Park</center> </h1>";
// echo "<h2><em>Electric Bill for Space $rv_space</em></h2>";
// echo "Month $current_date";
// echo "<body bgcolor=#00C0C0>";
// echo "<table width= 100%><tr><td width='10%'>Space
</td><td>
// Begin</td><td>
// End</td><td>Total KWH Used</td><td>Subtotal</td><td>Public
Use
// Fee</td><td>Total</td>";
// echo "<tr><center><td
width='10%'>$rv_space</em></td><td
// width='10%'>$row[begin]</td><td
width='10%'>$row[end]</td><td
// width='15%'>$tot_used</td><td
width='10%'>$sub_total</td><td
//
width='12%'>$puf.00</td><td>$total</td></center></table>";
// echo "<p><a href='index.php'>Return to Main Menu</a>
or<BR>";
// echo "<a
// href='search_elec_space_record.php?record=$row[rv_space]-1'>Previous
// Record</a></p>";
// echo "<a
// href='search_elec_space_record.php?record=$row[rv_space]+1'>Next
// Record</a></p>";
// echo "<a href='search_elec_space.php'>Search Another
Record</a></p>";
//
// I can get the first record say I choose space 35 if I click
// the link for
// $row[rv_space]+1 then it returns a blank page what can I do
// to fix this?
//
// Thanks again
// Jennifer
//
//
// "Beau Lebens" <B.Lebens@curtin.edu.au> wrote in message
// news:A2B098B4E624D511BED900508BB92A5701CA5222@exmsb02.curtin.
// edu.au...
// > jen,
// > assuming you are "currently" looking at a page which is
// something like
// > php.php?record=3, then you should be able to just do
// >
// > <a href='php.php?record=<?php echo ($record-1)
// ?>'>Previous record</a><a
// > href='php.php<?php echo ($record+1) ?>'>Next record</a>
// >
// > and then on the php.php page, you would obviously being
// grabbing something
// > from the database using a unique identifier or similar.
// >
// > one "gotcha" to be careful of - if there is a chance that
// your id field
// will
// > have a gap in it (ie. not be perfectly consecutive) then
// you should make
// > your query something like
// >
// > SELECT * FROM table LIMIT $record, 1
// >
// > rather than
// >
// > SELECT * FROM table WHERE id='$record'
// >
// > Since that takes them in whatever order, but only SELECTs
// from $record and
// > gets 1 record.
// >
// > HTH
// >
// > Beau
// >
// >
// > // -----Original Message-----
// > // From: Jennifer Downey [mailto:jendowney@attbi.com]
// > // Sent: Monday, 13 May 2002 1:14 PM
// > // To: php-db@lists.php.net
// > // Subject: [PHP-DB] Link for next db record
// > //
// > //
// > // Hi all,
// > //
// > // Wondering if you could help or point me to a tut where I
// > // can use a link to
// > // get the next record in the db?
// > //
// > // Like <a href='php.php'>Previous record</a><a
// > // href='php.php'>Next record</a>
// > //
// > // How do I go about doing this.
// > //
// > // Thanks
// > // Jennifer
// > //
// > // --
// > // The sleeper has awaken
// > //
// > //
// > // ---
// > // Outgoing mail is certified Virus Free.
// > // Checked by AVG anti-virus system (http://www.grisoft.com).
// > // Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
// > //
// > //
// > //
// > // --
// > // PHP Database Mailing List (http://www.php.net/)
// > // To unsubscribe, visit: http://www.php.net/unsub.php
// > //
//
//
// ---
// Outgoing mail is certified Virus Free.
// Checked by AVG anti-virus system (http://www.grisoft.com).
// Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
//
//
//
// --
// PHP Database Mailing List (http://www.php.net/)
// To unsubscribe, visit: http://www.php.net/unsub.php
//