Tablename page_no
column name min, max
i am storing value like min = 2 ,max = 12 in database like wise. value is inserted from textbox and it can be any.
i need a for loop to fetch data between min and max value. i cannot understand how to pass our min and max column in for loop
and how to display page no between range of 2 to 12 from database. for ex -- 2,3,4,5,6,7,8,9,10,11,12.
for ex---
i have two textbox in my form .textbox name is min and max. i am inserting value from textboxes. for ex min - 1 and max - 14 or any value like this. now i want to fetch value from database between min and max and display 1,2,3,4,5, etc upto max value in different rows. fir ex if i insert min=1 and max=14 then it display 1,2,3,4,5,6,7,8,9,10,11,12,13,14 no. in 14 different rows.
below is my code
<?php
$sqlpage = "SELECT * FROM page_no";
$resultpage = mysql_query($sqlpage);
if($rowpage = mysql_fetch_array($resultpage, MYSQL_ASSOC))
for($i=0;$i<$rowpage['min'];$i++)
{
if($i>=$min && $i<=$max)
{
?>
<tr>
<td><?php echo $i+1; ?></td>
</tr>
<?php
}
}
?>
for($i=$rowpage['min'];$i<$rowpage['max'];$i++)
{
<tr>
<td><?php echo $i; ?></td>
</tr>
}
Get your $i as min number and loop until it lower than the max number. Print the result
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.