Code : Tout sélectionner
--
-- Structure de la table `console`
--
CREATE TABLE `console` (
`id_console` tinyint(4) NOT NULL auto_increment,
`domaine_console` text NOT NULL,
`url_console` text NOT NULL,
`login_console` text NOT NULL,
`password_console` text NOT NULL,
KEY `id_console` (`id_console`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<div id="sectionLinks">
<?php
$console = "SELECT DISTINCT domaine_console FROM console ORDER BY domaine_console";
$console_retour = mysql_query ($console) or die (mysql_error());
while ($menu_affichage = mysql_fetch_array($console_retour) )
{
echo '<a href="#'.$menu_affichage['domaine_console'].'">'.ucfirst($menu_affichage['domaine_console']).'</a>';
};
?>
</div>
moi j'avais commencé a faire sa au niveau de l'affichage des données... mais ce que j'ai fais ici affiche toute les infos de ma table.....
<?php
include ('include/connectBD.inc.php');
include ('fonction/alternance_couleur.inc.php');
if (!isset($_GET['id'])) //SI la variable id_console existe
{
$ligne = "SELECT * FROM console ORDER BY url_console";
$ligne_retour = mysql_query ($ligne);
// Création d'un tableau
echo '<table width="100%" border="0" cellspacing="1" cellpadding="0">';
// CREATION d'une Ligne 1
echo '<tr>';
//CREATION de Cellule fixe
echo '<td width="14" id="cellule_tableau_email2"> </td>';
echo '<td width="16" id="cellule_tableau_email2"> </td>';
echo '<td width="200" bgcolor="#DFE6E6" id="cellule_tableau_email2"><span class="Style1"><strong> URL</strong></span></td>';
echo '<td width="150" bgcolor="#DFE6E6" id="cellule_tableau_email2"><span class="Style1"><strong> LOGIN</strong></span></td>';
echo '<td width="150" bgcolor="#DFE6E6" id="cellule_tableau_email2"><span class="Style1"><strong> PASSWORD</strong></span></td>';
// FIN de la ligne 1
echo "</tr>";
while ($ligne_ligne = mysql_fetch_array($ligne_retour) )
{
// CREATION d'une Ligne 2
echo "<tr bgcolor=\""; echo switchcolor(); echo "\">";
//Cellule SUPPRIMER
echo '<td bgcolor="#FFFFFF" width="14">';
echo '<a href="console.php?id='.$ligne_ligne['id_console'].'"><img src="images/corbeille.gif" alt="Supprimer" width="14" height="16" border="0"></a>';
echo '</td>';
//Cellule MODIFICATION
echo '<td bgcolor="#FFFFFF" width="16">';
echo '<a href="console_modifier.php?id='.$ligne_ligne['id_console'].'"><img src="images/modifier.gif" alt="Modifier" width="16" height="16" border="0"></a>';
echo '</td>';
//Cellule URL
echo '<td id="tableau_email" width="200">';
echo '<strong><a href="http://'.$ligne_ligne['url_console'].'" target="_blank" >'.$ligne_ligne['url_console'].'</strong>' ;
echo '</td>';
//Cellule LOGIN
echo '<td id="tableau_email" width="150">';
echo $ligne_ligne['login_console'];
echo '</td>';
//Cellule PASSWORD
echo '<td id="tableau_email" width="150">';
echo $ligne_ligne['password_console'] ;
echo '</td>';
//FIN de la ligne 2
echo '</tr>';
}
//FIN du tableau
echo '</table><br />';
}
Code : Tout sélectionner
<?php
$console = "SELECT DISTINCT domaine_console, id_console FROM console ORDER BY domaine_console";
$console_retour = mysql_query ($console) or die (mysql_error());
if (isset($_GET['id'])) //SI la variable id existe
{
$ligne = "SELECT * FROM console WHERE id_console = $_GET['id']";
$ligne_retour = mysql_query($ligne);
$ligne_retour_row = mysql_fetch_assoc($ligne_retour);
}
?>
<!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>
</head>
<body>
<div id="sectionLinks">
<?php while ($menu_affichage = mysql_fetch_assoc($console_retour))
{ ?>
<a href="<?php echo $_SERVER['PHP_SELF'].'?id='.$menu_affichage['id_console'];?>"><?php echo ucfirst($menu_affichage['domaine_console'])?></a>
<?php } ?>
</div>
<?php if (isset($ligne_retour_row['url_console']))
{?>
<div>
URL = <?php echo $ligne_retour_row['url_console']?> PASS = <?php echo $ligne_retour_row['password_console']?>
</div>
<?php } ?>
</body>
</html>
Code : Tout sélectionner
<?php
mysql_connect("$host", "$login", "$password");
mysql_select_db("nom_de_la_base_de_donnee");
$console = "SELECT DISTINCT domaine_console, id_console FROM console ORDER BY domaine_console";
$console_retour = mysql_query ($console) or die (mysql_error());
if (isset($_GET['id'])) //SI la variable id existe
{
$ligne = "SELECT * FROM console WHERE id_console = ".$_GET['id'];
$ligne_retour = mysql_query($ligne);
$ligne_retour_row = mysql_fetch_assoc($ligne_retour);
}
?>
<!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>
</head>
<body>
<div id="sectionLinks">
<?php while ($menu_affichage = mysql_fetch_assoc($console_retour))
{ ?>
<a href="<?php echo $_SERVER['PHP_SELF'].'?id='.$menu_affichage['id_console'];?>"><?php echo ucfirst($menu_affichage['domaine_console'])?></a>
<?php } ?>
</div>
<?php if (isset($ligne_retour_row['url_console']))
{?>
<div>
URL = <?php echo $ligne_retour_row['url_console']?> PASS = <?php echo $ligne_retour_row['password_console']?>
</div>
<?php } ?>
</body>
</html>Code : Tout sélectionner
Parse error: syntax error, unexpected T_ISSET, expecting '(' in C:\wamp\www\code_acces\test.php on line 29Code : Tout sélectionner
if isset($ligne_retour_row['url_console'])
Code : Tout sélectionner
<?php
mysql_connect("$host", "$login", "$pass");
mysql_select_db("$bdd");
$console = "SELECT DISTINCT domaine_console, id_console, url_console, password_console FROM console ORDER BY domaine_console";
$console_retour = mysql_query ($console) or die (mysql_error());
if (isset($_GET['id'])) //SI la variable id existe
{
$ligne = "SELECT * FROM console WHERE id_console = ".$_GET['id'];
$ligne_retour = mysql_query($ligne);
$ligne_retour_row = mysql_fetch_assoc($ligne_retour);
}
?>
<!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>
</head>
<body>
<div id="sectionLinks">
<?php while ($menu_affichage = mysql_fetch_assoc($console_retour))
{ ?>
<a href="<?php echo $_SERVER['PHP_SELF'].'?id='.$menu_affichage['id_console'];?>" onclick='document.getElementById("url").value="<?php echo $menu_affichage['url_console']?>";document.getElementById("pass").value="<?php echo $menu_affichage['password_console']?>";return false' ><?php echo ucfirst($menu_affichage['domaine_console'])?></a>
<?php } ?>
</div>
<div>
URL <input type="text" id = "url" value="<?php if (isset($ligne_retour_row['url_console'])) echo $ligne_retour_row['url_console']?>" style="width:200px" /> PASS <input type="text" id = "pass" value="<?php if (isset($ligne_retour_row['password_console'])) echo $ligne_retour_row['password_console']?>" style="width:200px" />
</div>
</body>
</html>
<?php
mysql_connect("$host", "$login", "$password");
mysql_select_db("$bdd");
$console = "SELECT DISTINCT domaine_console, id_console, url_console, password_console FROM console ORDER BY domaine_console";
$console_retour = mysql_query ($console) or die (mysql_error());
if (isset($_GET['id'])) //SI la variable id existe
{
$ligne = "SELECT * FROM console WHERE id_console = ".$_GET['id'];
$ligne_retour = mysql_query($ligne);
$ligne_retour_row = mysql_fetch_assoc($ligne_retour);
}
?>
<!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>
<script type="text/javascript">
<!--
function transfert(valeur_url,valeur_pass) {
document.getElementById("url").value = valeur_url;
document.getElementById("pass").value = valeur_pass;
}
//-->
</script>
</head>
<body>
<div id="sectionLinks">
<?php while ($menu_affichage = mysql_fetch_assoc($console_retour))
{ ?>
<a href="<?php echo $_SERVER['PHP_SELF'].'?id='.$menu_affichage['id_console'];?>" onclick='transfert("<?php echo $menu_affichage['url_console']?>","<?php echo $menu_affichage['password_console']?>");return false' ><?php echo ucfirst($menu_affichage['domaine_console'])?></a>
<?php } ?>
</div>
<div>
URL <input type="text" id = "url" value="<?php if (isset($ligne_retour_row['url_console'])) echo $ligne_retour_row['url_console']?>" style="width:200px" /> PASS <input type="text" id = "pass" value="<?php if (isset($ligne_retour_row['password_console'])) echo $ligne_retour_row['password_console']?>" style="width:200px" />
</div>
</body>
</html>
Bon courage! Quand tu auras compris tout ça tu auras déjà pas mal avancé. Une bonne adresse pour bien débuter avec d'excellents tutos sur www.phpdebutant.org (j'ai fait mes débuts avec eux)