par
Johanna » 23 mai 2015, 14:52
J'avais oublié "idMembre" dans ma requète.
Maintenant ça me donne ça
"Notice: Undefined index: prenom in /Applications/XAMPP/xamppfiles/htdocs/php/artisans/membre.php on line 1" quand je clique sur détail et que j'arrive sur la page "membre.php"
voici l'url que ça me met
http://localhost/php/artisans/membre.php?id=7 donc ça a l'air de bien récupérer l'id
Code : Tout sélectionner
<?php
// ---------------------------------------------------
$resultat = $pdo->query('SELECT idMembre, prenom, nom, metier, cp FROM membrea ORDER BY prenom DESC' , PDO::FETCH_ASSOC);
// permet d'accéder à la table membre et récupérer les information sous forme de tableau grace à FETCH_ASSOC
foreach($resultat as $membre) // Pour chaque membres
{ //echo '<pre>'; print_r($ligne); echo '</pre>';
$content .= "<tr>";
foreach($membre as $indice => $info) // Pour chaque information sur 1 membre
{
if($indice != 'id')
$content .= "<td>$info</td>";
}
$content.= '<td><a href="membre.php?id='.$membre['idMembre'].'">Détail</a></td>';
$content .= "</tr>";
}
$content .= '</table>';
//echo $content;
?>
<div class="resultat-artisan">
<div class="col-md-12">
<table id="example" class="display" cellspacing="0">
<thead>
<tr>
<th class="th-avatar">id</th>
<th class="th-avatar">Prénom</th>
<th class="th-avatar">Nom</th>
<th class="th-avatar">Métier</th>
<th class="th-avatar">Code postal</th>
<th class="th-avatar">Détail</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php echo $content; ?>
</td>
</tr>
</tbody>
</table>
Et voici mon code de ma page membre.php
Une idée d'où vient le problème?
J'avais oublié "idMembre" dans ma requète.
Maintenant ça me donne ça
"Notice: Undefined index: prenom in /Applications/XAMPP/xamppfiles/htdocs/php/artisans/membre.php on line 1" quand je clique sur détail et que j'arrive sur la page "membre.php"
voici l'url que ça me met http://localhost/php/artisans/membre.php?id=7 donc ça a l'air de bien récupérer l'id
[code]<?php
// ---------------------------------------------------
$resultat = $pdo->query('SELECT idMembre, prenom, nom, metier, cp FROM membrea ORDER BY prenom DESC' , PDO::FETCH_ASSOC);
// permet d'accéder à la table membre et récupérer les information sous forme de tableau grace à FETCH_ASSOC
foreach($resultat as $membre) // Pour chaque membres
{ //echo '<pre>'; print_r($ligne); echo '</pre>';
$content .= "<tr>";
foreach($membre as $indice => $info) // Pour chaque information sur 1 membre
{
if($indice != 'id')
$content .= "<td>$info</td>";
}
$content.= '<td><a href="membre.php?id='.$membre['idMembre'].'">Détail</a></td>';
$content .= "</tr>";
}
$content .= '</table>';
//echo $content;
?>
<div class="resultat-artisan">
<div class="col-md-12">
<table id="example" class="display" cellspacing="0">
<thead>
<tr>
<th class="th-avatar">id</th>
<th class="th-avatar">Prénom</th>
<th class="th-avatar">Nom</th>
<th class="th-avatar">Métier</th>
<th class="th-avatar">Code postal</th>
<th class="th-avatar">Détail</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php echo $content; ?>
</td>
</tr>
</tbody>
</table>[/code]
Et voici mon code de ma page membre.php
[code]<?php echo $_GET['prenom'] . ' ' . $_GET['nom']; ?> ![/code]
Une idée d'où vient le problème?