我有一個內部聯接三個表:內連接和回聲液
$result=mysql_query("SELECT singleimageupload.codrif AS codrif,
singleimageupload.imagesname AS bigimage,
uploads.imagesname AS multipleimage,
uploads.description AS multipledescription,
exposition.name,
exposition.author,
exposition.description,
exposition.misure,
exposition.date,
exposition.status
FROM exposition
INNER JOIN singleimageupload ON singleimageupload.codrif = exposition.codrif
INNER JOIN uploads ON uploads.codrif = exposition.codrif
WHERE singleimageupload.firstimage = 'first' AND exposition.codrif = 'A002'
ORDER BY exposition.codrif");
我有,人有這個條件,每個上傳路徑的結果我有。
所以,我想合併他們的鱈魚裏夫所有上傳路徑(在這個例子中,A002)。
這是我的全碼:
<?php
include('guestconfig/config.php');
$result=mysql_query("SELECT singleimageupload.codrif AS codrif,
singleimageupload.imagesname AS bigimage,
uploads.imagesname AS multipleimage,
uploads.description AS multipledescription,
exposition.name,
exposition.author,
exposition.description,
exposition.misure,
exposition.date,
exposition.status
FROM exposition
INNER JOIN singleimageupload ON singleimageupload.codrif = exposition.codrif
INNER JOIN uploads ON uploads.codrif = exposition.codrif
WHERE singleimageupload.firstimage = 'first' AND exposition.codrif = 'A002'
ORDER BY exposition.codrif");
while ($row = mysql_fetch_assoc($result)) {
?>
<table border="0">
<tr>
<td> <?php echo $row['codrif']?> </td>
</tr>
<tr>
<td> <?php echo $row['bigimage']?> </td>
</tr>
<tr>
<td> <?php echo $row['name']?> </td>
</tr>
<tr>
<td> <?php echo $row['author']?> </td>
</tr>
<tr>
<td> <?php echo $row['multipledescription']?> </td>
</tr>
<hr>
</table>
<?php } ?>
如果我解釋清楚,我希望如此,我不知道
**警告**請不要**使用'mysql_ *'函數,它們已被棄用,並在最新版本的PHP中被刪除。你也開放給mysql注入,你應該看看準備好的語句,但你必須先改變庫才能做到這一點。那些'mysql_ *'函數是從90年代開始的,請將它們保留在那裏。 – Nytrix
感謝您的建議。我將學習新的庫並更改mysql語句。 – James69
是的,抱歉,我忘記提及這些庫名稱。我會建議「PDO」或「mysqli」。 – Nytrix