Skip to main content

Posts

Showing posts from November 26, 2017

POPULATE DROPDOWN MENU FROM MYSQL

Populate  drop down menu from MYSQL: 1 2 3 4 5 6 7 8 <select name="user"> <?php $sql = mysqli_query ( $connect , "SELECT name FROM users" ); while ( $row = $sql -> fetch_assoc () ) { echo '<option value = "' . $row [ 'name' ] . '">' . $row [ 'name' ] . "</option>" ; } ?> </select> Show a drop down selected value coming from database: 1 2 3 4 5 6 7 8 9 10 11 <select name="user"> <?php $name = $users [ 'name' ]; $sql = mysqli_query ( $connect , "SELECT name FROM users" ); while ( $row = $sql -> fetch_assoc () ) { $selected = ( $row [ 'name' ] == $name ) ? 'selected="selected"' : '' ; echo '<option value="' . $row [ 'name' ] . '" ' . $selected . '>' . $row [ 'name...

SIMPLE PAGINATION USING PHP AND BOOTSTRAP

Hello guys, today we will learn how to create a simple pagination using PHP and Bootstrap. What is pagination? If you have a form which allows the user to browse through the rows in a database table, what do you do if that table has hundreds or even thousands of rows? It would not be a good idea to show all those rows in a single form, instead you should split the database output into more manageable chunks or 'pages'. There are two things you must do: Decide on the maximum number of database rows that can be included in each page. You may hard code this value, or (my preferred method) you can define it in a variable so that the value may be changed at runtime. You then need to inform the user that other 'pages' are available and provide a mechanism whereby the user is able to select a different 'page' of details. This is nothing but pagination area.                                 This area tells the ...