Bonjour @ tous,

Je souhaiterais afficher une image depuis une table SQL ci-dessous :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
CREATE TABLE `theme` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `periode_debut` date NOT NULL DEFAULT '0000-00-00',
  `periode_fin` date NOT NULL DEFAULT '0000-00-00',
  `url` text NOT NULL,
  `alt` text NOT NULL,
  KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=3 ;
Dans ma page PHP, j'aimerais qu'elle affiche une image à une URL précise pendant le jour ou la période depuis la BDD sinon elle affiche l'image "logo.gif" par défaut.

Je recherche un code PHP bien précis, j'ai tenté un code mais il est trop complexe et ne marche pas ! on m'avait communiqué une solution une fois, mais je l'ai perdu ;(
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php include("connect.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test</title>
</head>
 
<body>
<?php
if($periode_debut && $periode_fin)== echo date("Y-m-d");
{
echo "<img src=".$url." alt=".$alt." width="185" height="70" border="1">";
}
else
{
echo "<img src="img/fond.png" alt="" width="185" height="70" border="1">";
}
?>
</body>
</html>
<?php mysql_close(); ?>