8791 sujets

Développement web côté serveur, CMS

Bonjour,
Je désire afficher une image dans une news mais je n’y arrive pas, l’image est envoyée dans dossier un par un script qui me donne l’adresse où est stocké l’image.
J’ai fait une recherche sur le web, j’ai trouvé qu’il fallait enregistrer l’adresse où est stockée l’image dans la base de données, j’ai rajouté un champ « image » dans la table type varchar.
Mais après je suis perdue.

Voici le code pour afficher l’image

<------->
On se connecte à la base de données
<------->

<?php echo $reponse2['sujet']; ?></h3>
	<div class="news">
		<div class="titre"><em>post&eacute; par <?php echo $reponse2['posteur']; ?> <?php displayDate($reponse2['timestamp']); ?></em></div>
		<div class="corps"><?php echo stripslashes(html_entity_decode($reponse2['corps'])); ?></div>
	</div>
	<?php
	}
	?>





Voici le code pour envoyer les news


<table width="1000" border="1" cellpadding="5">
		<tr style="background-color:#DDDDDD">
			<td width="50">Id</td>
			<td width="225">Titre</td>
			<td width="325">Contenu</td>
			<td width="100">Date de cr&eacute;ation</td>
			<td width="100">Date de modification</td>
			<td width="100">Modifier</td>
			<td width="100">Supprimer</td>
		</tr>
		<?php
		if ($pageCourante==1)
			$limit = 0;
		else
			$limit = $newsParPage*($pageCourante-1);
			
		$sql	 = "SELECT * FROM news ORDER BY timestamp DESC LIMIT " . $limit . "," . ($newsParPage);
		$requete = mysql_query($sql);
		
		while($reponse = mysql_fetch_array($requete)) {		
		?>
		<tr>
			<td><?php echo $reponse['id']; ?></td>
			<td><?php echo $reponse['sujet']; ?></td>
			<td><?php echo tronquerTexte(strip_tags(stripslashes(html_entity_decode($reponse['corps']))), 100); ?></td>
			<td><?php echo date('d/m/Y H:i:s', $reponse['timestamp']); ?></td>
			<td><?php echo date('d/m/Y H:i:s', $reponse['timestamp_modif']); ?></td>
			<td><input type="button" value="Modifier" onclick="javascript:modifNews(<?php echo $reponse['id']; ?>)" /></td>
			<td><input type="button" value="Supprimer" onclick="javascript:confirmSupprNews(<?php echo $reponse['id']; ?>)" /></td>
		</tr>
		<?php
		}
		mysql_close();
		?>
	</table>
	<?php
	echo "<br />Pages : ";
	for ($i=1;$i<=$nbrDePages;$i++) {
		if ($i==$pageCourante)
			echo '<strong>' . $i . '</strong>&nbsp;&nbsp;';
		else
			echo '<a href="gestion_news.php?page=' . $i . '">' . $i . '</a>&nbsp;&nbsp;';
	}
	?>
	
	<h3>Ajouter une news</h3>
	
		<form name="ajout_news" id="ajout_news" method="post" action="gestion_news_ajout.php" target="_blank">
		<div>
			<!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded -->
			<div>
			
			<table cellpadding="5" border="0" width="500">
				<tr>
					<td width="200" align="right">Nom du posteur :</td>
					<td width="300"><input name="posteur" id="posteur" type="text" size="30" maxlenght="30" onchange="javascript:checkForm()" /></td>
				</tr>
				<tr>
					<td align="right">Titre :</td>
					<td><input name="titre" id="titre" type="text" size="30" maxlenght="60" onchange="javascript:checkForm()" /></td>
				</tr>
				<tr>
					<td align="right">Contenu de la news :</td>
					<td></td>
				</tr>
			</table>
			
				<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%">
				Texte de la news
				</textarea>
			</div>



merci d'avance
Modifié par Elkana (08 Jan 2010 - 12:27)
Modérateur
Bonjour Elkana,

Pourrais-tu éditer ton premier message afin de rendre ton titre plus explicite ? En effet, peu de membres du forum feront une recherche sur "Je rame", de même que peu s'y intéresseront étant donné son intitulé. Smiley cligne

Merci d'avance.