首頁>Program>source

我無法从刚用另一个表的SELECT語句建立的臨時表中获取資料。

$link = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();}
$query = "create temporary table temp1 select name from trn_games";
$query2 = "select name from temp1";
$result = mysqli_query($link, $query2) or die(mysqli_error()); 
while($row = mysqli_fetch_array($result)) {
echo $row['name'];
}
最新回復
  • 7月前
    1 #

    Note:- 對於由 SQL Query建立表 您應该由 mysqli_query($link, $query);執行

    您只編寫SQL查詢而不執行它。

    $query = "create temporary table temp1 select name from trn_games";
    $execute = mysqli_query($link, $query); or die(mysqli_error()); // here execute your SQL QUERY.
    $query2 = "select name from temp1";
    $result = mysqli_query($link, $query2); or die(mysqli_error()); 
    while($row = mysqli_fetch_array($result)) {
    echo $row['name'];
    }
    

  • LDAP Pooled Connection from Apache Java Library:来自Apache Java庫的LDAP池連線-我们需要取消繫結吗
  • matplotlib:Python-無法从statsmodel STL圖中提取資料