问题描述:

i have 2 table in my database:

first : Structure of table pointdevente

Colonne Type Null Défaut

IdPointDeVente int(11) Non

NomPDV varchar(50) Non

Lat varchar(10) Non

Long varchar(10) Non

Tel1 varchar(50) Non

Tel2 varchar(50) Non

Site varchar(50) Non

Email varchar(50) Non

MotDePasse varchar(50) Non

NomCommercant varchar(50) Non

DateIns date Non

DateExp date Non


Second: Structure of table produit

Colonne Type Null Défaut

IdProduit int(11) Non

Libelle varchar(100) Non

Designation varchar(300) Non

Prix double Non

Stock int(11) Non

IdPDV int(11) Non

IdCategorie int(11) Non

Image varchar(50) Non


question is how to show the name of nomPDV who is in table pointdevente in product.php

(sorry for my english)

<table>

<?php

while ($a=mysql_fetch_array($data)) {

?>

<tbody>

<tr>

<td><span class="unit-price"><?=$a['IdProduit'];?></span></td>

<td>

<a class="entry-thumbnail" data-toggle="lightbox"><img src=../images/<?php echo $a['Image']?> width="62px" height="82px"/></a>

<a href="../product.php?idproduit=<?=$a[IdProduit];?>" class="entry-url"><p><?=$a['Libelle'];?></p></a>

<a class="entry-title" href="product.html"></a>

</td>

<td><span class="unit-price"><?=$a['Libelle'];?></span></td>

<td width="11%"><span class="unit-price"><?=$a['Designation'];?></span></td>

<td><strong class="text-bold row-total"><span class="unit-price"><?=$a['Prix']." DT";?></span></strong></td>

<td><span class="unit-price"><?=$a['Stock'];?></span></td>

<td><span class="unit-price">

<?php

$nopdv = $a['IdPDV'];

$query = mysql_query("SELECT NomPDV from pointdevente WHERE IdPointDeVente=".$nopdv);

echo $query;

?>

</span></td>

<td><span class="unit-price"><?=$a['IdCategorie'];?></span></td>

<td class="hidden-xs"><button type="button" class="btn btn-primary" onClick="window.open('supprimer_produit.php?id_produit=<?=$a['IdProduit'];?>')">Supprimer</button></td>

</tr>

</tbody>

<?php

}

?>

</table>

网友答案:

I believe you mean in the place where you wrote:

echo $query

You want it to output the value extracted from the database? Replace that line with:

echo mysql_result($query, 0);
相关阅读:
Top