mysql - How to display data from database by getting inputs from user in php mqsql? -


how display data database user specified date range , comparing user input value database field value.

the query this:

$sql = "select * table date between '".$date_min"' , '".date_max"'"; 

assuming $date_min , $date_max values of user input, , table db table want query.

the php like:

$servername = "localhost"; $username = "username"; $password = "password"; $dbname = "mydb";  // create connection $conn = mysqli_connect($servername, $username, $password, $dbname); // check connection if (!$conn) {     die("connection failed: " . mysqli_connect_error()); }  $sql = "select * table date between '".$date_min"' , '".date_max"'"; $result = mysqli_query($conn, $sql);  if (mysqli_num_rows($result) > 0) {     // output data of each row     while($row = mysqli_fetch_assoc($result)) {         echo "id: " . $row["id"]. " - name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";     } } else {     echo "0 results"; }  mysqli_close($conn); 

provided made part user input.

these http://www.w3schools.com/php/php_mysql_select.asp.

some research before making question required.

regards


Comments