RE: [PHP-DB] Link for next db record

2002-05-13 Thread Beau Lebens

that will only set the value for $rv_space won't it?
have you echo'd out the values of the variables you are working with to make
sure that everything is being passed around properly?


// -Original Message-
// From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
// Sent: Monday, 13 May 2002 3:14 PM
// To: [EMAIL PROTECTED]
// Subject: Re: [PHP-DB] Link for next db record
// 
// 
// This line sets $row[rv_space]
// echoTRTDSearch Record by Space Number 
// /TDTDnbsp;INPUT size=4
// name=rv_space/TD/TR;
// 
// 
// 
// Beau Lebens [EMAIL PROTECTED] wrote in message
// news:[EMAIL PROTECTED].
// edu.au...
//  How are you setting the value for $row[rv_space] ?
// 
//  // -Original Message-
//  // From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
//  // Sent: Monday, 13 May 2002 2:01 PM
//  // To: [EMAIL PROTECTED]
//  // 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 h1centerSalmon Shores RV Park/center /h1;
//  // echo h2emElectric Bill for Space $rv_space/em/h2;
//  // echo Month $current_date;
//  // echo body bgcolor=#00C0C0;
//  // echo table width= 100%trtd width='10%'Space /tdtd
//  // Begin/tdtd
//  // End/tdtdTotal KWH Used/tdtdSubtotal/tdtdPublic Use
//  // Fee/tdtdTotal/td;
//  // echo trcentertd width='10%'$rv_space/em/tdtd
//  // width='10%'$row[begin]/tdtd width='10%'$row[end]/tdtd
//  // width='15%'$tot_used/tdtd width='10%'$sub_total/tdtd
//  // width='12%'$puf.00/tdtd$total/td/center/table;
//  // echo pa href='index.php'Return to Main Menu/a orBR;
//  // 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 [EMAIL PROTECTED] wrote in message
//  // news:[EMAIL PROTECTED].
//  // 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/aa
//  //  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:[EMAIL PROTECTED]]
//  //  // Sent: Monday, 13 May 2002 1:14 PM
//  //  // To: [EMAIL PROTECTED]
//  //  // 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/aa
//  //  // 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

RE: [PHP-DB] Link for next db record

2002-05-12 Thread Beau Lebens

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/aa
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:[EMAIL PROTECTED]]
// Sent: Monday, 13 May 2002 1:14 PM
// To: [EMAIL PROTECTED]
// 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/aa 
// 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
// 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php