[PHP] pb de generation de tableau auto 1 ligne Ok 2eme NaN

pb de generation de tableau auto 1 ligne Ok 2eme NaN [PHP] - PHP - Programmation

Marsh Posté le 13-12-2002 à 12:26:40    

<html>
<body bgcolor="#8794C9">
 
<?php
    $dbhost="localhost";
    $dblogin="root";
    $dbpassword="";
    $dbname="intranet";
   
    //recupere le contenu du champs du fichier MenuSql.php  
   
    $nom     = $_GET["liste1"];
 
    //requete qui teste l existance du nom dans la base de donnée Mysql
     mysql_connect($dbhost,$dblogin,$dbpassword);mysql_selectdb($dbname);
    $sql_results=mysql_query("select util.nom as 'nom',util.prenom as 'prenom',util.fonction as 'fonction',
 site.nom as 'site',serv.nom as 'service',soci.nom as 'societe',util.mail 'mail',util.telephone 'telephone'  
 from utilisateurs util,site,service serv,societe soci  
 where util.id_site = site.id_site and util.id_service = serv.id_service and
    util.id_societe = soci.id_societe and site.nom='$nom'" );
 
//print "nom=$nom ";
print"<br><hr>\n";
print " <center><H3>Liste téléphonique de <u>$nom</u> </H3></center>\n";
echo "<a href=menuSQL.php target=acceuil>Retour</a>";
?>
 
<center><input type="button" value="Imprimer" name="Exemple" OnClick="javascript:window.print()"></center>
<?
print"<br><hr><br>\n";
print "<table border=2>\n";
print "<TR>\n" ;
print "
 
 <TD width=80><b>Nom</b></TD>\n
 <TD width=80><b>Prénom</b></TD>\n
 <TD width=120><b>Fonction</b></TD>\n
 <TD width=120><b>Téléphone</b></TD>\n
 <TD width=120><b>Site</b></TD>\n
 <TD width=120><b>Société</b></TD>\n
 <TD width=120><b>Service</b></TD>\n";
 
    print "</TR>\n";
if($sql_results==null) echo mysql_error();
while($row = mysql_fetch_array($sql_results))
{  
     
 print "<TR>\n" ;
 print "
 
 <TD width=80>".$row['nom']. "</TD>\n
 <TD width=80>".$row['prenom']. "</TD>\n
 <TD width=120>".$row['fonction']. "</TD>\n
 <TD width=120>".$row['telephone']. "</TD>\n
 <TD width=120>".$row['site']. "</TD>\n
 <TD width=120>".$row['societe']. "</TD>\n
 <TD width=120>".$row['service']. "</TD>\n";
 
    print "</TR>\n";
 print "</table>\n";
}  
 mysql_close();
     
?>
 
 
 
la premiere ca marche bien la 2eme ligne NaN ca affiche tout mais pas ds le tablo  :cry:  

Reply

Marsh Posté le 13-12-2002 à 12:26:40   

Reply

Marsh Posté le 13-12-2002 à 12:29:29    

sakuraba a écrit :

<html>
<body bgcolor="#8794C9">
 
<?php
    $dbhost="localhost";
    $dblogin="root";
    $dbpassword="";
    $dbname="intranet";
   
    //recupere le contenu du champs du fichier MenuSql.php  
   
    $nom     = $_GET["liste1"];
 
    //requete qui teste l existance du nom dans la base de donnée Mysql
     mysql_connect($dbhost,$dblogin,$dbpassword);mysql_selectdb($dbname);
    $sql_results=mysql_query("select util.nom as 'nom',util.prenom as 'prenom',util.fonction as 'fonction',
 site.nom as 'site',serv.nom as 'service',soci.nom as 'societe',util.mail 'mail',util.telephone 'telephone'  
 from utilisateurs util,site,service serv,societe soci  
 where util.id_site = site.id_site and util.id_service = serv.id_service and
    util.id_societe = soci.id_societe and site.nom='$nom'" );
 
//print "nom=$nom ";
print"<br><hr>\n";
print " <center><H3>Liste téléphonique de <u>$nom</u> </H3></center>\n";
echo "<a href=menuSQL.php target=acceuil>Retour</a>";
?>
 
<center><input type="button" value="Imprimer" name="Exemple" OnClick="javascript:window.print()"></center>
<?
print"<br><hr><br>\n";
print "<table border=2>\n";
print "<TR>\n" ;
print "
 
 <TD width=80><b>Nom</b></TD>\n
 <TD width=80><b>Prénom</b></TD>\n
 <TD width=120><b>Fonction</b></TD>\n
 <TD width=120><b>Téléphone</b></TD>\n
 <TD width=120><b>Site</b></TD>\n
 <TD width=120><b>Société</b></TD>\n
 <TD width=120><b>Service</b></TD>\n";
 
    print "</TR>\n";
if($sql_results==null) echo mysql_error();
while($row = mysql_fetch_array($sql_results))
{  
     
 print "<TR>\n" ;
 print "
 
 <TD width=80>".$row['nom']. "</TD>\n
 <TD width=80>".$row['prenom']. "</TD>\n
 <TD width=120>".$row['fonction']. "</TD>\n
 <TD width=120>".$row['telephone']. "</TD>\n
 <TD width=120>".$row['site']. "</TD>\n
 <TD width=120>".$row['societe']. "</TD>\n
 <TD width=120>".$row['service']. "</TD>\n";
 
    print "</TR>\n";
 print "</table>\n";}  
 mysql_close();
     
?>
 
 
 
la premiere ca marche bien la 2eme ligne NaN ca affiche tout mais pas ds le tablo  :cry:  
 


 
ok j ai trouvé mon erreur je progresse bien la

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed