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
help with contest script
I would like to code a contest script to my site but i don't know how. Could someone just give me pu
Socket Server Response Headers
Earlier I had a post about my Socket Server, I wasn't able to get it to connect, now I can
I
Create a form of 2 numbers input and find the greatest.
Hi, everybody.
I have a homework in my training of php, which ask you to make a form that ask
Parse error: syntax error, unexpected T_ELSEIF in /home/......html/item.php on l
I do not know what is wrong with this. Hope some one can help. I do nto want to post the entire site
help need on ob_start()
Hi
I am a newbie in php, I have a code
Line number On/Off | Expand/Contract <?phpo
DateObject and Nulls
Hi all,
I have an array mapped to a value object. One of the items in the array is a PHP Date
use an array from 1 class in a second class
I have a class that adds data to an array
Then I have a second class and I need to check if t
is_dir() problem
Hello,
I'm buidling a php scripts that dynamically get's subfolders from a specific folder.
Dynamically allocating the number of rows in a table based on a variable value
Hi,
I have situation here which i cannot resolve, I have a variable temp which stores the num
Finding digits in variable containing text, and IDing them
$romanstock = "http://www.remoteprice.com/data.asp?storeid=123&itemcode=456&typ