Stan007
-
Posts
8 -
Joined
-
Last visited
Posts posted by Stan007
-
-
Hello Barand,
The problem is solved, this code that you suggested fixed it: 'page' => $current_page, <-- CHANGED
You really helped me thanks a lot, you have a new fan. Will be making donations pretty soon.
Thanks again
Stanley
-
Hi Barand,
Thanks so much, the italian.php is now automatically added to the url like this: http://localhost/menuboard/italian.php?page=1&country=Italian But even when you click on link for page 2, the page always = 1
So you dont actually go to any subsequent page corresponding to the link you clicked. You remain at the index page.
-
Hello Barand,
yes it does work when i put italian and page=2 in the url and takes me rightly to page 2
this is the url that works but i had to put back italian.php in the url manually: http://localhost/board/italian.php?page=2&country=Italian
-
Hello Barand,
let me check that now
Thanks so much for replying
-
Guys thanks for helping me solve the problem i had but now i have another problem and i am lost. i have included the code below for you to have overview.
On the home page the url shows how it should be: http://localhost/board/italian.php?country=Italian
BUT
When you mouse over the NEXT link to go to next page you get this : http://localhost/board/?page=1&country=Italian and then an error 404 when you click on the link
page = 1 no matter if you are mousing over link for page 5 or 2This is the code:
<table style="width:100%; margin-left:auto; margin-right:auto">
<?php
$items_per_page = 5;//how many records/rows to display per page
$page_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$cleaned_current_page_country = htmlspecialchars($_GET["country"]);
$page_number = (isset($_GET['page']))? filter_var($_GET['page']) : 1;
//$page_number = filter_var($_GET['page']);
//$page_number = $_GET['page'];
$selected_restaurant_type = $_GET['country'];
// find number of rows in the db
$query = "SELECT * FROM menu_update WHERE special_of_theday = 1 AND restaurant_type = '".$selected_restaurant_type."' ";
$query_result = mysqli_query($connection, $query);
$row_count = mysqli_fetch_array($query_result);
$total_rows = mysqli_num_rows($query_result);
$expected_number_of_pages = ceil($total_rows/$items_per_page); //expected number of pages
$page_position = (($page_number - 1) * $items_per_page); //get starting position to fetch record
//fetch a group of records using sql LIMIT clause
$query = "SELECT * FROM menu_update WHERE special_of_theDay = 1 AND restaurant_type = '".$selected_restaurant_type."' LIMIT " .$page_position. ',' .$items_per_page;
$query_result = mysqli_query($connection, $query);
?>
<table width="100%" border=0>
<tr bgcolor = "#cccccc">
<td>Meal</td>
<td>Meal name</td>
<td>Meal Price</td>
<td>Order Now</td>
<td>Full Menu</td>
<td>Our Gallery</td>
<td>Find Us</td>
<td>Our Chef</td>
<td>Our Manager</td>
</tr>
<?php
while($row_count = mysqli_fetch_array($query_result)){
echo "<tr>";
echo"
<td style ='width:200px; text-align:center; height:120px; background:#eaedf2'><a href='meal_fullPic.php'><img src= ".$row_count['img']." /></a></td>
<td style ='width:119px; text-align:center; height:120px; background:#eaedf2'> ".$row_count['meal_name']."</td>
<td style ='width:100px; text-align:center; height:120px; background:#eaedf2'>".$row_count['price']."</td>
<td style ='width:100px; text-align:center; height:120px; background:#eaedf2'><a href='order_processor.php'><img src= ".$row_count['order_now']." /></a></td>
<td style ='width:100px; text-align:center; height:120px; background:#eaedf2'><a href='full_menu.php'><img src= ".$row_count['full_menu_img']." /></a></td>
<td style ='width:170px; text-align:center; height:120px; background:#eaedf2'><a href='restaurant_gallery.php'><img src= ".$row_count['restaurant_pic']." /></a></td>
<td style ='width:100px; text-align:center; height:120px; background:#eaedf2'><a href='restaurant_location.php'><img src= ".$row_count['location_pic']." /></a></td>
<td style ='width:119px; height:120px; background:#eaedf2'> ".$row_count['chef_name']."</td>
<td style ='width:119px; height:120px; background:#eaedf2'> ".$row_count['admin']."</td>
";
echo "</tr>";
}
mysqli_close($connection);
?>
</table>
<div class="board_pagination">
<?php
//display the links to the pages
for($current_page = 1; $current_page <= $expected_number_of_pages; $current_page++){
if ($page_number != $expected_number_of_pages){
$data = array(
'page' => $page_number,
'country' => $cleaned_current_page_country,
);
$the_query = http_build_query($data);
$page_url .= '?' . $the_query;
echo '<li><a href=" '.$the_query.' ">'.$current_page.'</a></li> ';
}
}
?>
</div>
</table>
-
Guys i am so thankful for all the help and support, i am overwhelmed. I will try every idea suggested about and get back to you guys......Many thanks guys.
-
this is what i want in the url
http://localhost/board/italian.php?page=2&country=italianwhen this link is clicked
echo "<a href='?page=".($page_number + 1)." ".(&)." country=".($cleaned_current_page_country)."'>Next</a>";but i keep getting this error:
Parse error: syntax error, unexpected '&' in C:\xampp\htdocs\board\includes\menuboard_main_display.php on line 105appreciate any help
Problem fixed but caused new problem
in PHP Coding Help
Posted
Hello Barand,
One last request please, i just noticed that when i click link and arrive at second page, i dont have any back link. Can you please help me with the pagination section of the code.
Thanks a million