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
Securing a user input - need some confirmation
Hello All,
I am in the process of recoding a large proportion of an e-commerce site, one of t
PHP & Images [Resize, Crop, Save]
Hey! Well I have a little dilema, hoping I could find some guidance.
I have a CMS and on the
Bit manipulation program with binary operations
My homework is to create a program to scan in and add binary numbers and print them like so
PHP mail() with images
I'm trying to get images to send along with my HTML e-mail sent through PHP mail(). I only tried vie
Parse Error
Hi Guys,
I have a function in my class which returns a string link variable. The problem is i
read integers that returns a negative or prints the average
Im trying to finish this homework assignment by tommarow afternoon and I keep getting stuck.
Wr
SQL Query/echo not working
Hey all,
I'm trying to run (what I thought) was a simple operation and it isn't working. I h
Creating a function
Basically i wanna put all this code in a seperate file
Code: <?php
Having a problem get the selected item from a drop down menu
I have been looking at this for days now.
I have a drop down menu that get it's values from a
timed header image rotation
I have a joomla site and I was trying to setup a rotating image based on timing NOT just refreshing