Extraction du nom de la table
Bonjour,
Je voudrais savoir comment est-il possible dans une requete php d'extraire le nom de la table ou provient cette donnée ?
Je m'explique. J'ai une requête SQL qui tape dans 2 tables :
Code:
1 2 3 4 5 6 7
| $sql = 'SELECT id_produit,type_produit,ros,client,adresse,adresseb,ville,codepostal,villeb,codepostalb,clientb FROM histo WHERE UPPER(histo.client) LIKE \'%' . $_GET['clienta'] . '%\'
UNION
SELECT id_produit,type_produit,ros,client,adresse,adresseb,ville,codepostal,villeb,codepostalb,clientb FROM encours WHERE UPPER(encours.client) LIKE \'%' . $_GET['clienta'] . '%\'';
$qry = mysql_query($sql);
while($row = mysql_fetch_assoc($qry)) {
$dataHisto[] = $row;
} |
Le $_GET['clienta'] provient d'un
Code:
<INPUT type="text" value="" name="clienta">
Plus bas je l'affiche dans un tableau :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <p>
<!-- Données de la table
************************************************************-->
<table>
<thead>
<tr>
<th>Produit</th>
<th>Type</th>
<th>Client</th>
<th>Adresse A</th>
<th>Adresse B</th>
<th>ROS</th>
</tr>
</thead>
<tbody>
<?php foreach($dataHisto as $row): ?>
<tr>
<td><?php echo $hsc($row['id_produit']); ?></td>
<td><?php echo $hsc($row['type_produit']); ?></td>
<td><?php echo $hsc($row['client']); ?></td>
<td><?php echo $hsc($row['adresse']); ?> <?php echo $hsc($row['codepostal']); ?> <?php echo $hsc($row['ville']); ?></td>
<td><?php echo $hsc($row['adresseb']); ?> <?php echo $hsc($row['codepostalb']); ?> <?php echo $hsc($row['villeb']); ?></td>
<td><?php echo $hsc($row['ros']); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</p> |
Je voudrais savoir, comment peut-on faire pour que dans la dernière colonne de ce tableau, il y soit affiché si cette entrée provient de ma table "histo" ou de ma table "encours".
J'ai cherché autour du SHOW TABLE mais je ne vois pas..
Merci d'avance :)