Probléme en PHP5
Résolu
ing_future
Messages postés
11
Date d'inscription
Statut
Membre
Dernière intervention
-
ing_future Messages postés 11 Date d'inscription Statut Membre Dernière intervention -
ing_future Messages postés 11 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
vraiment excusé moi pour cette question
J'ai un code en php5 et j'ai utilisé la méthodologie PDO
le problème c'est que si je tape un mot à rechercher je reçoit toutes les informations correspond à ce mot sauf le lien de titre qui ne change plus et m'a donnés le même résultat à chaque fois
En bref
ma requette utilise 3 tables
1) client ==> id_clt et nom _clt
2)contact ==> id_contact et nom_contact et id_clt
3)ticket ==> id_ticket et titre et id_contact
la premiere page contient une zonne de texte =>nom_societe
et voila la deuxieme page
---------------------------------------------------------------
<html>
<head>
<style type="text/css">
<!--
.Style1 {color: #FF0000}
.Style2 {
color: #FF0000;
font-style: italic;
font-weight: bold;
font-size: x-large;
}
.Style3 {
color: #000000;
font-size: 12px;
}
-->
</style>
</head>
<body>
<body>
<table width="942" height="90" border="1">
<tr>
<td><div align="center" class="Style1">IMAGE PHOTOSHOP</div></td>
</tr>
</table>
</br></br></br>
<p>
<?php require_once "head.inc.php"; ?>
<span class="title">: </span><br>
<br>
</p>
<p align="center" class="Style2"> </p>
<?php
if (empty($mots) && isset($mots) && $mots=="") exit;
$mots=htmlentities($_POST['nom_societe'], ENT_QUOTES,'UTF-8');
$sql=$cnx->prepare("SELECT * FROM contact,client,ticket WHERE (
nom_clt LIKE '%" . $mots . "%' OR adresse_clt LIKE '%" . $mots . "%' OR mail_clt LIKE '%" . $mots . "%' )
AND nom_clt='".$_POST['nom_societe']."'
ORDER BY nom_clt ");
?>
<table border="1" width="100%">
<tr>
<td>Nom</td>
<td>Adresse</td>
<td>Email</td>
<td>Tel</td>
<td>Portable</td>
</tr>
<?php
$sql -> execute(array());
$tab = array();
while ($lignes = $sql -> fetch(PDO::FETCH_ASSOC))
{
echo '<tr>';
$tab['nom_clt'] = $lignes['nom_clt'];
$tab['titre'] = $lignes['titre'];
$tab['adresse_clt'] = $lignes['adresse_clt'];
$tab['mail_clt'] = $lignes['mail_clt'];
$tab['tel_clt'] = $lignes['tel_clt'];
echo '<td >'.$tab['nom_clt'].'</td>';
echo ' <td>';
echo '<a href="./lire_select.php?id_ticket=' , $tab['id_ticket'] , '">' , htmlentities(trim($tab['titre'])) , '</a>';
echo ' </td>';
echo '<td bgcolor="#CCFFCC">'.$tab['adresse_clt'].'</td>';
echo '<td bgcolor= #FFCC99>'.$tab['mail_clt'].'</td>';
echo '<td bgcolor="#00ECEC" >'.$tab['tel_clt'].'</td>';
echo '</tr>';
?>
</table>
<?php } ?>
Merçii d'avance :)
vraiment excusé moi pour cette question
J'ai un code en php5 et j'ai utilisé la méthodologie PDO
le problème c'est que si je tape un mot à rechercher je reçoit toutes les informations correspond à ce mot sauf le lien de titre qui ne change plus et m'a donnés le même résultat à chaque fois
En bref
ma requette utilise 3 tables
1) client ==> id_clt et nom _clt
2)contact ==> id_contact et nom_contact et id_clt
3)ticket ==> id_ticket et titre et id_contact
la premiere page contient une zonne de texte =>nom_societe
et voila la deuxieme page
---------------------------------------------------------------
<html>
<head>
<style type="text/css">
<!--
.Style1 {color: #FF0000}
.Style2 {
color: #FF0000;
font-style: italic;
font-weight: bold;
font-size: x-large;
}
.Style3 {
color: #000000;
font-size: 12px;
}
-->
</style>
</head>
<body>
<body>
<table width="942" height="90" border="1">
<tr>
<td><div align="center" class="Style1">IMAGE PHOTOSHOP</div></td>
</tr>
</table>
</br></br></br>
<p>
<?php require_once "head.inc.php"; ?>
<span class="title">: </span><br>
<br>
</p>
<p align="center" class="Style2"> </p>
<?php
if (empty($mots) && isset($mots) && $mots=="") exit;
$mots=htmlentities($_POST['nom_societe'], ENT_QUOTES,'UTF-8');
$sql=$cnx->prepare("SELECT * FROM contact,client,ticket WHERE (
nom_clt LIKE '%" . $mots . "%' OR adresse_clt LIKE '%" . $mots . "%' OR mail_clt LIKE '%" . $mots . "%' )
AND nom_clt='".$_POST['nom_societe']."'
ORDER BY nom_clt ");
?>
<table border="1" width="100%">
<tr>
<td>Nom</td>
<td>Adresse</td>
<td>Email</td>
<td>Tel</td>
<td>Portable</td>
</tr>
<?php
$sql -> execute(array());
$tab = array();
while ($lignes = $sql -> fetch(PDO::FETCH_ASSOC))
{
echo '<tr>';
$tab['nom_clt'] = $lignes['nom_clt'];
$tab['titre'] = $lignes['titre'];
$tab['adresse_clt'] = $lignes['adresse_clt'];
$tab['mail_clt'] = $lignes['mail_clt'];
$tab['tel_clt'] = $lignes['tel_clt'];
echo '<td >'.$tab['nom_clt'].'</td>';
echo ' <td>';
echo '<a href="./lire_select.php?id_ticket=' , $tab['id_ticket'] , '">' , htmlentities(trim($tab['titre'])) , '</a>';
echo ' </td>';
echo '<td bgcolor="#CCFFCC">'.$tab['adresse_clt'].'</td>';
echo '<td bgcolor= #FFCC99>'.$tab['mail_clt'].'</td>';
echo '<td bgcolor="#00ECEC" >'.$tab['tel_clt'].'</td>';
echo '</tr>';
?>
</table>
<?php } ?>
Merçii d'avance :)
1 réponse
j'vais un probléme en requete mmmmm,,,
voilaaa
$sql=$cnx->prepare("SELECT distinct(nom_clt),mail_clt,titre,adresse_clt,tel_clt FROM contact,client,ticket WHERE (
nom_clt LIKE '%" . $mots . "%' OR adresse_clt LIKE '%" . $mots . "%' OR mail_clt LIKE '%" . $mots . "%' )
AND nom_clt='".$_POST['nom_societe']."'
AND ticket.id_contact=contact.id_contact
AND contact.id_clt=client.id_clt
");
Merçiiiiiiiiiiiiii
voilaaa
$sql=$cnx->prepare("SELECT distinct(nom_clt),mail_clt,titre,adresse_clt,tel_clt FROM contact,client,ticket WHERE (
nom_clt LIKE '%" . $mots . "%' OR adresse_clt LIKE '%" . $mots . "%' OR mail_clt LIKE '%" . $mots . "%' )
AND nom_clt='".$_POST['nom_societe']."'
AND ticket.id_contact=contact.id_contact
AND contact.id_clt=client.id_clt
");
Merçiiiiiiiiiiiiii