par
x@v » 24 mars 2007, 07:33
Bonjour,
j'essaie d'afficher un résultat qui existe dans ma base.
la première fonctionn s'affiche au chargement et quand je clique je devrai avoir un résultat mais rien y fait ?
function produitvu() {
$reponse = new xajaxResponse();
$req = "SELECT * FROM conte ORDER BY id";
$query = mysql_query($req);
$txt = '<table width="100%" border="0" cellspacing="5">';
$i=0;
while($tb = mysql_fetch_assoc($query)){
if($i%9 == 0) $txt .= '<tr>';
$txt .= '<td align="center"><br><img style="cursor:hand;" width="110" height="161" src="' . $tb['photo'] . '" alt="' . $tb['nom'] . '" OnClick="xajax_detailvu(\'' . $tb['nom'] . '\');"><br>('.$tb['id']. ')</td>';
if(($i+1%9) == 0) $txt .= '</tr>';
$i++;
}
$txt .= '</table>';
$reponse->addAssign("detail", "innerHTML", $txt);
return $reponse->getXML();
}
function detailvu($conte) {
$reponse = new xajaxResponse();
$req = "SELECT * FROM pages WHERE rubrique='$conte)'";
$query = mysql_query($req);
// $distinct="SELECT rubrique FROM pages";
$txt = '';
$donnees = mysql_fetch_assoc($query);
$txt .= '<table width="100%" border="0" cellspacing="5">';
$txt .= '<tr><td colspan="2"><b>' . $donnees['rubrique'] . '</b></td></tr>';
$txt .= '<tr>';
$txt .= '<td valign="top">' . $donnees['page'] . '<img src="' . $donnees['photo'] . '" alt="' . $donnees['nom'] . '"><br>';
$txt .= $donnees['page'] . '<br>';
$txt .= '<input type="button" id="commande" value="Commander" OnClick="xajax_ajoutcaddie(' . intval($id) . ');">';
$txt .= '</td>';
$txt .= '<td>' . nl2br($donnees['description']) . '</td>';
$txt .= '</tr>';
$txt .= '</table>';
$reponse->addAssign("detail", "innerHTML", $txt);
return $reponse->getXML();
}
Merci
Bonjour,
j'essaie d'afficher un résultat qui existe dans ma base.
la première fonctionn s'affiche au chargement et quand je clique je devrai avoir un résultat mais rien y fait ?
[php]function produitvu() {
$reponse = new xajaxResponse();
$req = "SELECT * FROM conte ORDER BY id";
$query = mysql_query($req);
$txt = '<table width="100%" border="0" cellspacing="5">';
$i=0;
while($tb = mysql_fetch_assoc($query)){
if($i%9 == 0) $txt .= '<tr>';
$txt .= '<td align="center"><br><img style="cursor:hand;" width="110" height="161" src="' . $tb['photo'] . '" alt="' . $tb['nom'] . '" OnClick="xajax_detailvu(\'' . $tb['nom'] . '\');"><br>('.$tb['id']. ')</td>';
if(($i+1%9) == 0) $txt .= '</tr>';
$i++;
}
$txt .= '</table>';
$reponse->addAssign("detail", "innerHTML", $txt);
return $reponse->getXML();
}
function detailvu($conte) {
$reponse = new xajaxResponse();
$req = "SELECT * FROM pages WHERE rubrique='$conte)'";
$query = mysql_query($req);
// $distinct="SELECT rubrique FROM pages";
$txt = '';
$donnees = mysql_fetch_assoc($query);
$txt .= '<table width="100%" border="0" cellspacing="5">';
$txt .= '<tr><td colspan="2"><b>' . $donnees['rubrique'] . '</b></td></tr>';
$txt .= '<tr>';
$txt .= '<td valign="top">' . $donnees['page'] . '<img src="' . $donnees['photo'] . '" alt="' . $donnees['nom'] . '"><br>';
$txt .= $donnees['page'] . '<br>';
$txt .= '<input type="button" id="commande" value="Commander" OnClick="xajax_ajoutcaddie(' . intval($id) . ');">';
$txt .= '</td>';
$txt .= '<td>' . nl2br($donnees['description']) . '</td>';
$txt .= '</tr>';
$txt .= '</table>';
$reponse->addAssign("detail", "innerHTML", $txt);
return $reponse->getXML();
}[/php]
Merci