........ 依要求填入 mysql 語法,其中資料庫名稱依題目要求修改。
<?php
$dbhost = 'localhost:3306';
$dbuser = 'root';
$dbpass = '123qwe';
$str = $_GET['str'];
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error().PHP_EOL);
$sql = ".............";
$retval = mysql_db_query( 'dbd',$sql ) or die(mysql_error().PHP_EOL);
while($row = mysql_fetch_array($retval, MYSQL_NUM)) {
echo "{$row[0]}\t{$row[1]}\t{$row[2]}\n";
}
mysql_close($conn);
?>
$str 的紀錄,變數 $str 由 php get 取得。列出 tblcx.id, tblcx.author, tblcy.count。
$str 的紀錄,變數 $str 由 php get 取得。列出 tblcx.id, tblcx.author, tblcy.count,條件為 author 同時出現在兩個資料表的紀錄。
$str 的紀錄,變數 $str 由 php get 取得。列出 tblcx.id, tblcx.author, tblcy.count,條件為 author 同時出現在兩個資料表的紀錄。
$str') 將查詢到的 NULL 欄位輸出成 $str,變數 $str 由 php get 取得。
$str 開頭數字結尾」的紀錄,變數 $str 由 php get 取得。列出所有欄位,但因 tblcy 只有兩個欄位,所以 php 檔中的陣列 row 輸出 $row[2]} 必須刪除。