io ho bisogno di estrarre i dati da due tabelle contemporaneamente..
ovvero mentre estraggo un record dalla tabella prodotti devo estrarre le informazioni sul fornitore dalla tabella fornitori..
io ho scritto questo codice, che però non funziona,.. se qualcuno me lo correggesse...
grazie anticipatamente
Codice PHP:
$link=mysql_connect($host,$user,$pwd) or die("Non riesco a connettermi");
mysql_select_db ("Sql15965_1");
$action ="SELECT * FROM prodotti WHERE Codice LIKE '%$_GET[Codice]%' ";
$result = mysql_query($action, $link) or die ("Mysql dice: " . mysql_error());
while ($row = mysql_fetch_array($result)) {
$ac ="SELECT * FROM fornitori WHERE Fornitore LIKE '%$row[Fornitore]%' ";
$re = mysql_query($ac, $link) or die ("Mysql dice: " . mysql_error());
while ($Row = mysql_fetch_array($re)) {
if ($row[Commento]==""){
$row[Commento]="Nessun commento disponibile";}
if ($row[Foto]==""){
$row[Foto]="Nessuna immagine disponibile";}
else{
$immagine="<img src=\"$row[Foto]\">";}
echo"<table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td width=\"21%\">
<center>";
if ($Row[web]<>"") {
echo"<a href=\"$Row[web]\">$Row[Logo]</a>";}
echo"
</center>
</td>
<td width=\"54%\">
<center>
<font face=\"Times New Roman, Times, serif\" size=\"6\" color=\"#0066cc\"> $row[Descrizione] </font>
</center>
</td>
<td width=\"25%\">
<center>
<font size=\"6\" color=\"#0066cc\">$row[PrzPub] €</font>
</center>
</td>
</tr>
<tr>
<td align=\"center\">Codice: $row[Codice]</td>
<td align=\"center\">Gruppo: $row[Gruppo] </td>
<td align=\"center\">$row[SottoGr]</td>
</tr></table>
<table>
<tr>
<td>$row[Foto]
$Commento</td>
</tr>
</table> " ;} }