tonguim
07-21-2004, 07:49 AM
Hi all,
i would like to print the records of my database in a table. I also would like that the line "l" of the table has the color x, and the line "l+1" has the color y. Could anyone give my some help please? Thank you.
<?php // ligne 1
{
$host = "localhost"; // ligne 4
$user = "root"; // ligne 5
$passwd = ""; // ligne 6
$dataB = "annuaireUo"; //ligne 7: chemin de la base de donnees
// ligne 8
$connBD = mysql_connect ($host, $user, $passwd); //ligne 9: connection au serveur MySql
mysql_select_db ($dataB, $connBD); // ligne 10: connection a la BD
$Insertion = "insert into personnel (matricule, nom, prenom, sexe, profession, email, adresse, telDomicile, telMobile, grade ) VALUES ('".$_POST['matricule']."', '".$_POST['nom']."', '".$_POST['prenom']."', '".$_POST['sexe']."', '".$_POST['profession']."', '".$_POST['email']."', '".$_POST['adresse']."', '".$_POST['telDomicile']."', '".$_POST['telMobile']."', '".$_POST['grade']."')"; // ligne 12
mysql_query ($Insertion);
//mysql_close(); // ligne 14
}
//////////////////////////////////////// affichage des enregistrements dans un tableau ////////////////////////////////
$sql_query = "select * from personnel";
$result = mysql_query($sql_query);
<table> // ligne 22
while ($result && $row = mysql_fetch_array($result))
{
echo "
<tr>
<td> "Grade " .$row["matricule"]." </td> //ligne 27
<td>."Nom " .$row["nom"]." </td>
<td>."Sexe " .$row["sexe"]." </td>
<td>."Fonction " .$row["fonction"]." </td>
<td>."Profession ".$row["profession"]."</td>
<td>."Direction " .$row["direction"]." </td> //ligne 32
<td>."Service " .$row["service"]." </td>
<td>."E-mail " .$row["email"]." </td>
<td>."Téléphone " .$row["telService"]."</td> //ligne 35
</tr>";
}
</table>
mysql_close(); //ligne 40
?>
</html> //ligne 42
i would like to print the records of my database in a table. I also would like that the line "l" of the table has the color x, and the line "l+1" has the color y. Could anyone give my some help please? Thank you.
<?php // ligne 1
{
$host = "localhost"; // ligne 4
$user = "root"; // ligne 5
$passwd = ""; // ligne 6
$dataB = "annuaireUo"; //ligne 7: chemin de la base de donnees
// ligne 8
$connBD = mysql_connect ($host, $user, $passwd); //ligne 9: connection au serveur MySql
mysql_select_db ($dataB, $connBD); // ligne 10: connection a la BD
$Insertion = "insert into personnel (matricule, nom, prenom, sexe, profession, email, adresse, telDomicile, telMobile, grade ) VALUES ('".$_POST['matricule']."', '".$_POST['nom']."', '".$_POST['prenom']."', '".$_POST['sexe']."', '".$_POST['profession']."', '".$_POST['email']."', '".$_POST['adresse']."', '".$_POST['telDomicile']."', '".$_POST['telMobile']."', '".$_POST['grade']."')"; // ligne 12
mysql_query ($Insertion);
//mysql_close(); // ligne 14
}
//////////////////////////////////////// affichage des enregistrements dans un tableau ////////////////////////////////
$sql_query = "select * from personnel";
$result = mysql_query($sql_query);
<table> // ligne 22
while ($result && $row = mysql_fetch_array($result))
{
echo "
<tr>
<td> "Grade " .$row["matricule"]." </td> //ligne 27
<td>."Nom " .$row["nom"]." </td>
<td>."Sexe " .$row["sexe"]." </td>
<td>."Fonction " .$row["fonction"]." </td>
<td>."Profession ".$row["profession"]."</td>
<td>."Direction " .$row["direction"]." </td> //ligne 32
<td>."Service " .$row["service"]." </td>
<td>."E-mail " .$row["email"]." </td>
<td>."Téléphone " .$row["telService"]."</td> //ligne 35
</tr>";
}
</table>
mysql_close(); //ligne 40
?>
</html> //ligne 42