Ligne blanche dans réponse mysql
Bonjour,
J'ai créé un champ de recherche qui ouvre une base phpadmin dont voici le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| // on se connecte à MySQL
$db = mysql_connect('localhost', ' ', ' ');
echo '<div class="creux1">';//début du cadre
// on seléctionne la base
mysql_select_db('Nom de ma base',$db);
}
echo '<table cellspacing="0" cellpadding="0" border="1" width="100%" align="center" >';
echo '<th width="10%"><span style="color: #FBF413; font-family: Arial; font-size: 16px;">NOM</th>';
echo '<th width="10%"><span style="color: #FBF413; font-family: Arial; font-size: 16px;">PRENOM</th>';
echo '<th width="20%"><span style="color: #FBF413; font-family: Arial; font-size: 16px;">SOCIETE</th>';
echo '<th width="11%"><span style="color: #FBF413; font-family: Arial; font-size: 16px;">PROFESSION</th>';
echo '<th width="16%"><span style="color: #FBF413; font-family: Arial; font-size: 16px;">ADRESSE</th>';
echo '<th width="5%"><span style="color: #FBF413; font-family: Arial; font-size: 16px;">CODE</th>';
echo '<th width="12%"><span style="color: #FBF413; font-family: Arial; font-size: 16px;">VILLE</th>';
echo '<th width="8%"><span style="color: #FBF413; font-family: Arial; font-size: 16px;">TEL</th>';
echo '<th width="8%"><span style="color: #FBF413; font-family: Arial; font-size: 16px;">G S M</th>';
// Creation de la requete SQL
$sql = "SELECT nom,prenom,societe,metier,adresse1,cp,ville,tel,portable FROM clients WHERE nom LIKE '%$rech%' OR prenom LIKE '%$rech%' OR societe LIKE '%$rech%' OR metier LIKE '%$rech%' OR adresse1 LIKE '%$rech%' OR cp LIKE '%$rech%' OR ville LIKE '%$rech%' OR tel LIKE '%$rech%' OR portable LIKE '%$rech%' ORDER BY nom ASC ";
// on envoie la requête
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
// on fait une boucle qui va faire un tour pour chaque enregistrement
while($datas = mysql_fetch_array($req))
{
// on affiche les informations de l'enregistrement en cours
echo '<tr>';
echo '<td width="10%" align="center"><span class="coul1">' .$datas['nom'].' ' .'</span></td>';
echo '<td width="10%" align="center"><span class="coul1">' .$datas['prenom'].' ' .'</span></td>';
echo '<td width="20%" align="center"><span class="coul1">' .$datas['societe'].' ' .'</span></td>';
echo '<td width="11%" align="center"><span class="coul1">' .$datas['metier'].' ' .'</span></td>';
echo '<td width="16%" align="center"><span class="coul1">' .$datas['adresse1'].' ' .'</span></td>';
echo '<td width="5%" align="center"><span class="coul1">' .$datas['cp'].' ' .'</span></td>';
echo '<td width="12%" align="center"><span class="coul1">' .$datas['ville'].' ' .'</span></td>';
echo '<td width="8%" align="center"><span class="coul1">' .$datas['tel'].' ' .'</span></td>';
echo '<td width="8%" align="center"><span class="coul1">' .$datas['portable'].' ' .'</span></td>';
echo '</tr>';
echo '<br>';
}
echo '</table>';
echo '</div>';//Fin du cadre
echo '<br>'; |
Or lorsque je lance une recherche et qu'il trouve 2 lignes... j'ai 2 lignes blanches au début, puis les réponses.
S'il trouve 8 réponses, j'ai 8 lignes blanches puis les réponses.
J'ai essayé un tas de solutions, rien n'y fait !
Quelqu'un pourrait me dire ou j'ai fait l'erreur ? Car erreur il y a.
D'avance, merci.