-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdate.php
32 lines (26 loc) · 923 Bytes
/
date.php
1
<?php $con=mysqli_connect("localhost", "milap", "test", "milap_test"); // Check connectionif (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error();}// escape variables for security$date = mysqli_real_escape_string($con, $_POST['date']);//Select items corresponding to date$select="Select * FROM stocks WHERE date='$date'"; if (!mysqli_query($con,$select)) { die('Error: ' . mysqli_error($con));}else { //print data $result = mysqli_query($con,"SELECT * FROM stocks where date = '$date'"); $row = mysqli_fetch_array($result); echo "date" . " " . "open" . " " . "high" . " " . "low" . " " . "close"; echo "<br>"; echo $row['date'] . " " . $row['open'] . " " . $row['high'] . " " . $row['low'] . " " . $row['close'];}mysqli_close($con);//header("Location: index.php");?>