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
27
Other forums
problem with sql querry in php script
Hello guys,
What I want to do is I want to read out a csv file and then but te conent ot the
ereg_replace issue
hi there people
i have this code happening with regards to my wamp server. is this something
Multiple Dropdown Selections
I have a form that let's a user insert a page with the ability to select categories. I want them to
How To Make More Than One Redirection with PHP on the same page?
Hey im trying to do a direction page where it open differently link direction pages every time som
How to add functionality to a simple php calender?
Hello everyone,
I have just finished creating a simple php calander. Can someone point
Loops and Classes
I am making a template system and everything seems to be going well up until I have to loop in a var
Passing an array of values From VB6.0 to Oracle PL/SQL Function
Basically we are using VB6.0.
When we try to pass an array from VB6.0 to an Oracle PL/SQL
Contents of variable not echoing
Hey guys, hopefully this is an easy one...
In this line, the variables are not echoing out. T
url- go to webpage
i have an input text field and submit button.
how do i make the url entered into the textfiel
CURL XML Request [From C to PHP]
Hi,
I need some help converting this into something that will work with PHP.
Code: #