Code PhP pour afficher une BDD
Bonjour à tous. :)
Voilà, je rencontre un problème avec un code PhP et une Base de Donnée MYSQL.
J'ai créé une base de donnée qui s'appelle tours. A l'intérieur, j'ai 5 champs :
tourid - Int (11) (Auto-increment)
title - text
date - date
summary - text
image - text
Je veux afficher cette base sur une page home.inc.php
Code:
1 2 3 4 5 6 7 8 9
| <?php
include('connect.php');
$date = date("Y-m-d");
$tomorrow = date("Y-m-d",strtotime("+24 hours"));
$query_TourList = "SELECT tourid, title, date, summary, image FROM tours WHERE date >= '$date' ORDER BY date ASC LIMIT 3";
$TourList = mysql_query($query_TourList) or die(mysql_error());
$row_TourList = mysql_fetch_assoc($TourList);
$totalRows_TourList = mysql_num_rows($TourList); |
J'ai ça tout en haut de ma page, puis, à l'endroit où je veux afficher les "tours" :
Code:
1 2 3 4 5 6 7
| <?php if($totalRows > 0) { do { ?>
<h3><?php echo $row['date']; ?> <?php echo $row['title']; ?></h3>
<p><?php echo $row['summary']; ?></p>
<p class="content-list"><a href="index.php?page=details&id=<?php echo $row['tourid']; ?>">Plus d'informations</a></p>
<?php } while ($row = mysql_fetch_assoc($TourList));
} else {echo '<br></br><p style="margin-bottom: 20px; margin-left: 10px; color: gray;"><i>Il n\'y a pas d\'Event plannifie...</i></p>';}
?> |
Mais cela ne fonctionne pas. J'ai à chaque fois affiché 'Il n'y a pas d'Event plannifie..."
Je ne trouve pas d'où ça vient... :'(
Pouvez-vous m'aider ?
Cordialement