Salut à tous
Voilà, j'ai une base sql avec un champs titres et je souhaiterai faire apparaitre à l'écran la liste dees titres contenus dans la table. Jusqu'ici pas de pb mais j'ai remarqué que dans certaines cases il y a avait un espace après le titre (et des fois avant). Comment faire pour ne faire apparaitre qu'une seule fois e titres sans changer les titres un à un dans la table?
Voici mon code:
<?php session_start(); ?>
<?php require_once('../Connections/DISQUES.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {function GetSQLValueString($theValue, $theType, $theDefinedValue
"", $theNotDefinedValue "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_DISQUES, $DISQUES);
$query_liste_titres = "SELECT Titre FROM titres GROUP BY Titre ORDER BY Titre ASC";
$liste_titres = mysql_query($query_liste_titres, $DISQUES) or die(mysql_error());
$row_liste_titres = mysql_fetch_assoc($liste_titres);
$totalRows_liste_titres = mysql_num_rows($liste_titres);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns="
http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
<style type="text/css">
<!--
body {
background-image: url(fond_admin.jpg);
}
a:link {
color: #000000;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
color: #000000;
}
a:active {
text-decoration: none;
color: #000000;
}
.Style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #000000;
}
.Style2 {color: #000000}
-->
</style></head>
Liste titres (<?php echo $totalRows_liste_titres ?>)
----
Titre,
<?php do { ?>
----
" class="Style2">
<?php echo rtrim($row_liste_titres['Titre']," "); ?>
,
<?php } while ($row_liste_titres = mysql_fetch_assoc($liste_titres)); ?>
</html>
<?php
mysql_free_result($liste_titres);
?>
Afficher la suite