Erreur Php 'select'
2301
-
rudak Messages postés 590 Date d'inscription Statut Membre Dernière intervention -
rudak Messages postés 590 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
voila c'est une commande de base qui me pose probleme
$sql="select id_customer_arabic,last_name_arabic,first_name_arabic,city_arabic,country_arabic, ref_customer_arabic,date_sys from customer_arabic order by country_arabic ASC;";
$res = mysql_query($sql,$conn) or die( mysql_error() ) ;$ligne=mysql_num_rows($res);$row=mysql_fetch_array($res);
if($ligne==0) { echo'Table vide.........Aucun Enregistrment'; } else {
echo '<table bgcolor="#FFFFFF">' . "\n" ; echo '<tr>' ; echo '<table bgcolor="#FFFFFF">' . "\n"
; echo '<tr>' ; echo '<td bgcolor="#0099ff"><b><u><center> <font color="ffffff">Date</font></center></u></b></td>' ; echo '<td bgcolor="#0099ff"><b><u><center> <font color="ffffff">id</font></center></u></b></td>' ;echo '<td bgcolor="#0099ff"><b><u><center> <font color="ffffff">last name</font></center></u></b></td>' ; echo '<td bgcolor="#0099ff"><b><u><center> <font color="ffffff">first name</font></center></u></b></td>' ; echo '<td bgcolor="#0099ff"><b><u><center> <font
color="ffffff">city</font></center></u></b></td>' ; echo '<td bgcolor="#0099ff"><b><u><center> <font color="ffffff">country</font></center></u></b></td>' ; echo '<td bgcolor="#0099ff"><b><u><center> <font color="ffffff">ref_customer</font></center></u></b></td>' ; echo '<td bgcolor="#0099ff"><b><u><center> <font color="ffffff">Affiche detail</font></center></u></b></td>' ; echo '</tr>' . "\n" ;
while( $row=mysql_fetch_array ($res)) { $id_customer_arabic=$row ['0'];
$last_name_arabic=$row
['1']; $first_name_arabic=$row ['2']; $city_arabic=$row ['3']; $country_arabic=$row ['4']; $ref_customer_arabic=$row ['5']; $date_sys=$row ['6']; echo '<tr>' ; echo '<td bgcolor="#CCCCCC"><center>' . $date_sys. '</center></td>' ; echo '<td bgcolor="#CCCCCC"><center>' . $id_customer_arabic. '</center></td>' ; echo '<td bgcolor="#CCCCCC"><center>' . $last_name_arabic. '</center></td>' ; echo '<td bgcolor="#CCCCCC"><center>' . $first_name_arabic. '</center></td>'
; echo '<td bgcolor="#CCCCCC"><center>' . $city_arabic. '</center></td>' ; echo '<td bgcolor="#CCCCCC"><center>' . $country_arabic. '</center></td>' ; echo '<td bgcolor="#CCCCCC"><center>' . $ref_customer_arabic. '</center></td>' ; echo '<td bgcolor="#CCCCcc"><center><a href="detailarabic.php?id_customer_arabic='.$row['id_customer_arabic'].'"> affiche detail</a></center></td>'; echo '</tr>' . "\n" ; } echo '</table>' . "\n" ;}mysql_close($conn);?>
je sais que ma table existe avec des enregistrements mais
1- s' il y a un seul enregistrements le tableau s'affiche avec les listes des champs seulements
2- sinon si (au moins 2 enreg ) s'affiche le premiere enreg seulement
3-sinon(aucun enreg ) s'affiche un message 'Table vide.........Aucun Enregistrment'.
je voi pas pourquoi
voila c'est une commande de base qui me pose probleme
$sql="select id_customer_arabic,last_name_arabic,first_name_arabic,city_arabic,country_arabic, ref_customer_arabic,date_sys from customer_arabic order by country_arabic ASC;";
$res = mysql_query($sql,$conn) or die( mysql_error() ) ;$ligne=mysql_num_rows($res);$row=mysql_fetch_array($res);
if($ligne==0) { echo'Table vide.........Aucun Enregistrment'; } else {
echo '<table bgcolor="#FFFFFF">' . "\n" ; echo '<tr>' ; echo '<table bgcolor="#FFFFFF">' . "\n"
; echo '<tr>' ; echo '<td bgcolor="#0099ff"><b><u><center> <font color="ffffff">Date</font></center></u></b></td>' ; echo '<td bgcolor="#0099ff"><b><u><center> <font color="ffffff">id</font></center></u></b></td>' ;echo '<td bgcolor="#0099ff"><b><u><center> <font color="ffffff">last name</font></center></u></b></td>' ; echo '<td bgcolor="#0099ff"><b><u><center> <font color="ffffff">first name</font></center></u></b></td>' ; echo '<td bgcolor="#0099ff"><b><u><center> <font
color="ffffff">city</font></center></u></b></td>' ; echo '<td bgcolor="#0099ff"><b><u><center> <font color="ffffff">country</font></center></u></b></td>' ; echo '<td bgcolor="#0099ff"><b><u><center> <font color="ffffff">ref_customer</font></center></u></b></td>' ; echo '<td bgcolor="#0099ff"><b><u><center> <font color="ffffff">Affiche detail</font></center></u></b></td>' ; echo '</tr>' . "\n" ;
while( $row=mysql_fetch_array ($res)) { $id_customer_arabic=$row ['0'];
$last_name_arabic=$row
['1']; $first_name_arabic=$row ['2']; $city_arabic=$row ['3']; $country_arabic=$row ['4']; $ref_customer_arabic=$row ['5']; $date_sys=$row ['6']; echo '<tr>' ; echo '<td bgcolor="#CCCCCC"><center>' . $date_sys. '</center></td>' ; echo '<td bgcolor="#CCCCCC"><center>' . $id_customer_arabic. '</center></td>' ; echo '<td bgcolor="#CCCCCC"><center>' . $last_name_arabic. '</center></td>' ; echo '<td bgcolor="#CCCCCC"><center>' . $first_name_arabic. '</center></td>'
; echo '<td bgcolor="#CCCCCC"><center>' . $city_arabic. '</center></td>' ; echo '<td bgcolor="#CCCCCC"><center>' . $country_arabic. '</center></td>' ; echo '<td bgcolor="#CCCCCC"><center>' . $ref_customer_arabic. '</center></td>' ; echo '<td bgcolor="#CCCCcc"><center><a href="detailarabic.php?id_customer_arabic='.$row['id_customer_arabic'].'"> affiche detail</a></center></td>'; echo '</tr>' . "\n" ; } echo '</table>' . "\n" ;}mysql_close($conn);?>
je sais que ma table existe avec des enregistrements mais
1- s' il y a un seul enregistrements le tableau s'affiche avec les listes des champs seulements
2- sinon si (au moins 2 enreg ) s'affiche le premiere enreg seulement
3-sinon(aucun enreg ) s'affiche un message 'Table vide.........Aucun Enregistrment'.
je voi pas pourquoi
A voir également:
- Erreur Php 'select'
- Erreur 4201 france tv ✓ - Forum Réseaux sociaux
- Erreur 0x80070643 - Accueil - Windows
- Expert php pinterest - Télécharger - Langages
- Erreur 4101 france tv - Forum Lecteurs et supports vidéo
- J'aime par erreur facebook notification - Forum Facebook
1 réponse
Bonjour,
votre code est assez pénible à lire.
commencez par l'épurer (utilisez du code css pour background et font) cela pourra être aussi bénéfique pour vous.
allez à la ligne et indenter le, on y verra plus clair
Merci
ça pourrait faire quelque chose comme ça:
<style>
td {
background-color:#00099ff;
color:#FFFFFF;
font-weight:bold;
font-style: italic;
text-align:center;
text-decoration:underline;
}
</style>
if($ligne==0) {
echo'Table vide.........Aucun Enregistrment';
}
else {
echo '<table bgcolor="#FFFFFF">' . "\n" ;
echo '<tr>' ;
echo '<table bgcolor="#FFFFFF">' . "\n" ;
echo '<tr>' ; echo '<td>Date</td>' ;
echo '<td>id</td>' ;
echo '<td>last name</td>' ;
echo '<td>first name</td>' ;
echo '<td>city</td>' ;
echo '<td>country</td>' ;
echo '<td>ref_customer</td>' ;
echo '<td>Affiche detail</td>' ;
echo '</tr>' . "\n" ;
while( $row=mysql_fetch_array ($res)) {
$id_customer_arabic=$row ['0'];
$last_name_arabic=$row ['1'];
$first_name_arabic=$row ['2'];
$city_arabic=$row ['3'];
$country_arabic=$row ['4'];
$ref_customer_arabic=$row ['5'];
$date_sys=$row ['6'];
echo '<tr>' ;
echo '<td>' . $date_sys. '</td>' ;
echo '<td>' . $id_customer_arabic. '</td>' ;
echo '<td>' . $last_name_arabic. '</td>' ;
echo '<td>' . $first_name_arabic. '</td>';
echo '<td>' . $city_arabic. '</td>' ;
cho '<td>' . $country_arabic. '</td>' ;
echo '<td>' . $ref_customer_arabic. '</td>' ;
echo "<td><a href='detailarabic.php?id_customer_arabic=".$row['id_customer_arabic']."> affiche detail</a></td>"; echo "</tr>" . "\n" ;
}
echo '</table>' . "\n" ;
}
mysql_close($conn);?>
Pour qu'il ait le moins de mécontents possible il faut toujours taper sur les mêmes.
(comme vous l'avez reconnu : proverbe shadocks)
votre code est assez pénible à lire.
commencez par l'épurer (utilisez du code css pour background et font) cela pourra être aussi bénéfique pour vous.
allez à la ligne et indenter le, on y verra plus clair
Merci
ça pourrait faire quelque chose comme ça:
<style>
td {
background-color:#00099ff;
color:#FFFFFF;
font-weight:bold;
font-style: italic;
text-align:center;
text-decoration:underline;
}
</style>
if($ligne==0) {
echo'Table vide.........Aucun Enregistrment';
}
else {
echo '<table bgcolor="#FFFFFF">' . "\n" ;
echo '<tr>' ;
echo '<table bgcolor="#FFFFFF">' . "\n" ;
echo '<tr>' ; echo '<td>Date</td>' ;
echo '<td>id</td>' ;
echo '<td>last name</td>' ;
echo '<td>first name</td>' ;
echo '<td>city</td>' ;
echo '<td>country</td>' ;
echo '<td>ref_customer</td>' ;
echo '<td>Affiche detail</td>' ;
echo '</tr>' . "\n" ;
while( $row=mysql_fetch_array ($res)) {
$id_customer_arabic=$row ['0'];
$last_name_arabic=$row ['1'];
$first_name_arabic=$row ['2'];
$city_arabic=$row ['3'];
$country_arabic=$row ['4'];
$ref_customer_arabic=$row ['5'];
$date_sys=$row ['6'];
echo '<tr>' ;
echo '<td>' . $date_sys. '</td>' ;
echo '<td>' . $id_customer_arabic. '</td>' ;
echo '<td>' . $last_name_arabic. '</td>' ;
echo '<td>' . $first_name_arabic. '</td>';
echo '<td>' . $city_arabic. '</td>' ;
cho '<td>' . $country_arabic. '</td>' ;
echo '<td>' . $ref_customer_arabic. '</td>' ;
echo "<td><a href='detailarabic.php?id_customer_arabic=".$row['id_customer_arabic']."> affiche detail</a></td>"; echo "</tr>" . "\n" ;
}
echo '</table>' . "\n" ;
}
mysql_close($conn);?>
Pour qu'il ait le moins de mécontents possible il faut toujours taper sur les mêmes.
(comme vous l'avez reconnu : proverbe shadocks)
rudak
Messages postés
590
Date d'inscription
Statut
Membre
Dernière intervention
46
je confirme ya pas mieu pour s'y perdre qu'un code crade comme ca...