Ticker (600600 - 600626)
Start Date
End Date

600626||trim($ticker)==""||strlen($ticker)<6||!is_numeric($ticker)){ echo "

Please enter a valid ticker!

"; exit; } //check date selection if($start_date>$end_date){ echo "

Wrong date range!

"; exit; } $conn=mysql_connect("localhost", "zyili", "529529") or die(mysql_error()); //create the connecction with mysql $db=mysql_select_db("zyili", $conn) or die(mysql_error()); //select the database $sql="SELECT date, open_price, high_price, low_price, close_price FROM zyili_data WHERE ticker=$ticker AND date>='$start_date' AND date<='$end_date'"; //execute sql query and get results $sql_result=mysql_query($sql, $conn) or die(mysql_error()); $num_results=mysql_num_rows($sql_result); echo'

Number of records found: '.$num_results.'

'; //start results formatting if($num_results==0){exit;} else{ //format results by row echo ''; for($i=0; $i<$num_results; $i++){ $row=mysql_fetch_array($sql_result); $date=$row["date"]; $open=$row["open_price"]; $high=$row["high_price"]; $low=$row["low_price"]; $close=$row["close_price"]; echo ""; } } echo "
Date Open High Low Close
$date $open $high $low $close
"; echo "Back to Top"; } ?>