//SQL:
$bgcolor1="#D3DCE3";
$bgcolor2="#CCCCCC";
$bgcolor3="#DDDDDD";
/*
1. the syntax of if-else statement
2. if nothing is filled by the user, the variable $studname will be blank or be 0,
in this situation, !$studname will be 1 for which ! denotes NEGATIVE.
3. $studname is also blank when this program is first started.
*/
//@$querystr1=str_replace("\n"," ",$querystr);
if (!@$querystr)
{
echo "Please enter a SQL statement!!!";
exit;
}
else{
@ $db = mysql_connect("localhost", "sample", "sample");
if (!$db) {
echo "Error: Could not connect to database. Please try again later.";
exit;
}
mysql_select_db("sample");
$result = mysql_query($querystr1);
if(!$result){
echo "SQL statement has syntax error!";
exit ;
}
echo "SQL¡G".$querystr1;
echo " ";
$num_results = mysql_num_rows($result);
if ($num_results==0) {
echo "No match";
exit;
}
$row = mysql_fetch_array($result);
echo "
";
echo "has reached the max row";
exit;
}
}
echo "";
}
echo "Today's date:";
//The following statement is used to show today;s date in a detailed format.
echo date ("l dS of F Y h:i:s A");
?>