SQL Statement

³Ì¦hÅã¥Ü¡Gµ§
".@$querystr1.""; ?>

$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 "
"; while($element=each($row)){ if(is_string($element[ "key" ])){ echo ""; } } echo "\n"; reset($row); while($element=each($row)){ if(is_string($element[ "key" ])){ echo ""; } } echo ""; $i=1; while($row = mysql_fetch_array($result)){ if (($i %2)==0) $bgcolor=$bgcolor3; else $bgcolor=$bgcolor2; echo ""; while($element=each($row)){ if(is_string($element[ "key" ])){ echo ""; } } echo ""; $i++; if ($i==$maxrow){ echo "
".$element[ "key" ]."
".$element[ "value" ]."
".$element[ "value" ]."
"; 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"); ?>