Tableau php (problème affichage)
Bonsoir tout le monde,
j'ai un tout petit problème, je voudrai affiché mes données réccupérer de la requête dans un tableau sauf que je suis bloquée,
voila mon code, et le résultat que j'ai c'est une ligne où les trois champs sont collées
le résultat que j'ai en image
http://img200.imageshack.us/img200/9523/captureraj.jpg
j'ai un tout petit problème, je voudrai affiché mes données réccupérer de la requête dans un tableau sauf que je suis bloquée,
voila mon code, et le résultat que j'ai c'est une ligne où les trois champs sont collées
le résultat que j'ai en image
http://img200.imageshack.us/img200/9523/captureraj.jpg
if ($req->rowCount()>0)
{
while ($data = $req->fetch(PDO::FETCH_OBJ)) {
echo '<tr>';
echo '<tr>'.$data->sujet.'</tr>';
echo '<tr>'.$data->specialite.'</tr>';
echo '<tr>'.$data->rapport.'</tr>';
echo '</tr>';
}
}
else
6 réponses
-
toujours le même résultat :-(
-
echo "<table>";
if ($req->rowCount()>0)
{
while ($data = $req->fetch(PDO::FETCH_OBJ)) {
echo '<tr>';
echo '<td>'.$data->sujet.'</td>';
echo '<td>'.$data->specialite.'</td>';
echo '<td>'.$data->rapport.'</td>';
echo '</tr>';
}
}
else
{
echo'<h3> Aucun résultat</h3>';
}
echo "</table>"; -
ca donne le résultat que mon premier post :-(
-
-
Bonsoir,
c'est toujours le même résultat malheureusement
http://img200.imageshack.us/img200/9523/captureraj.jpg
voilà mon code:
table border="0" >
<tr BGCOLOR="#D6D6D6"><th>Sujet</th><th>Spécialité</th><th>Rapport</th></tr>
</table>
<?php
try {
$bdd= new PDO ('mysql:host=localhost;dbname=pfe','root','') or die(print_r($bdd->errorInfo()));
$bdd->exec('SET NAMES utf8');
}
catch(Exception $e){
die('Erreur:'.$e->getMessage());
}
$req=$bdd->query("SELECT * FROM specialite WHERE sujet LIKE '%$search%' OR specialite LIKE '%$search%' ORDER BY idspecialite");
if ($req->rowCount()>0)
{
while ($data = $req->fetch(PDO::FETCH_OBJ)) {
echo '<tr>';
echo '<td>'.$data->sujet.'</td>';
echo '<td>'.$data->specialite.'</td>';
echo '<td>'.$data->rapport.'</td>';
echo '</tr>';
}
}
else
{
echo'<h3> Aucun résultat</h3>';
}
?> -
-
-
-
-
echo '<tr>';
echo '<td>'.$data->sujet.'</td>';
echo '<td>'.$data->specialite.'</td>';
echo '<td>'.$data->rapport.'</td>';
echo '</tr>'; -
Bonsoir,
non je l'ai déjà essayé et ca donne un alignement vertical malheureusement
http://img543.imageshack.us/img543/1386/capturerh.jpg
y a pas d'autre solution :-( -
c'est pas mieu comme ca :
echo '<table>'; echo '<tr><td>'.$data->sujet.'</td></tr>'; echo '<tr><td>'.$data->specialite.'</td></tr>'; echo '<tr><td>'.$data->rapport.'</td></tr>'; echo '</tr></table>';
__
_/ \_____________________
\__/ - diablobros was here -