How to show next and prev records


Posted on 16th Feb 2014 07:03 pm by admin

Hi all,

Sorry if this is simple, i'm very new to php, well, any programming language actually.

My code runs a query and comes back with the results. Very rarely there may be more than one result.

I have added the code that I think should enable me to go to the next and previous records but it is not working. I have tried lots of different bits of code so now its all over the shop!

Can you help please?

Jamie
Code: [Select]<?php
//run ext query
require("conf.php");
{
$udf_form = $_POST['udf'];

$extract = mysql_query ("SELECT * FROM cy_equ WHERE udf = '$udf_form' LIMIT 1 ");
$numrows = mysql_num_rows ($extract);

while ($row = mysql_fetch_assoc($extract))
{
$id = $row['id'];
$equ = $row['equ'];
$ext = $row['ext'];
$udf = $row['udf'];
$udf2 = $row['udf2'];
$udf3 = $row['udf3'];

$next = $udf + 1;
$prev = $udf - 1;

}

}

$next = $udf_form + 1;
$prev = $udf_form - 1;



?>

<div class="boxextqry">
<h3> UDF Query </h3>
<form name="form1" method="post" action="../index1.php?page=udfsearch">
<p> Input UDF: <input type="number" name="udf" size="1" maxlength="4"/></p>


<p> ID = <font color="red"><?php echo $id; ?> </font> </p>
<p> EXT = <font color="red"><?php echo $ext; ?> </font> </p>
<p> EQU = <font color="red"><?php echo $equ; ?> </font></p>
<p> UDF = <font color="red"><?php echo $udf; ?> </font></p>
<p> UDF2 = <font color="red"><?php echo $udf2; ?> </font></p>
<p> UDF3 = <font color="red"><?php echo $udf3; ?> </font></p>

<p><input type="submit" name="submit" value="GET DATA"/></p>
<p><input type="submit" name="udf[<?php echo $next?>]" value="NEXT"/></p>
<p><input type="submit" name="udf[<?php echo $prev?>]" value="PREV"/></p>

</form>

</div>

No comments posted yet

Your Answer:

Login to answer
214 Like 27 Dislike
Previous forums Next forums
Other forums

The IE or FF detector
Hello Friends,

Problem of today ( we seek for php help ) as following ,

we know all th

PHP Code / Script To check weather the given email exists in a domain
Hi,

I want to implement the following in my web page

in sign up we will ask to enter u

Help With editting and deleting form
Hallo !!

So look at this image :

http://img194.imageshack.us/img194/8272/snapshot5f.pn

Problems with strings containing
Hey all,

I have encountered something strange in a script. I am trying to write an XML heade

Help with Contact Form
I have this Form on an html page and the associated code on page.php (below).
I keep getting the

Inserting Data into a MS Access DB using PHP.
As part of my uni course I am doing a placement at a company whom want me to create a client zone fo

Material Issuing for receiving batch
Dear All experts in MM/ PP,

Material issuing from main stores to factory is currently usi

Just cannot get 'area' to submit to db using same php code as already used
Basically all i have done is just modified some code and added an area section.
The form is allre

Using Curl_multi for processing multiple URLs
Hi,

I am at a loss as to how to implement this. I would like to be able to automatically assi

BI in Upstream Production operations
Appreciate if you can assist in the following areas:
1) Examples of life before and after BI i

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash