affichage d'infos depuis sql

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : affichage d'infos depuis sql

par ouckileou » 01 nov. 2005, 18:34

ben ça
<p>;
c'est du HTML
qu'est-ce que ça vient faire au milieu du PHP ?

si tu veux écrire du code HTML utilise des fonctions pour écrire : echo, print...etc

par yuuzhantar » 01 nov. 2005, 18:26

sa y est

à chaque ligne, j'ai mis un echo ' ';

sa affiche quelque chose maintenant

il n'y a plus qu'un petit bug

par yuuzhantar » 01 nov. 2005, 18:14

en fait c pas bon

maintenant, mon code est celui-ci
<?php 
$db = mysql_connect('sql.free.fr', 'xxx', 'xxx');  // 1 
mysql_select_db('yuu_sw',$db);                    // 2 
$req = mysql_query("SELECT ban_id, ban_lien, ban_emp, ban_fond, ban_color, ban_color2, ban_txt, ban_credits, ban_affiche, ban_affichage FROM a_ban WHERE user_id='$id3'");          // 3 
while($data = mysql_fetch_assoc($req))
	{
	<p>;
	<table width="494" height="280" border="0" cellpadding="0" cellspacing="0">;
        <tr>;
          <td colspan="2" rowspan="3"><img src="'.$data['ban_emp'].'" width="468" height="60"></td>;
          <td width="26" height="20"><div align="center"><a href="/echange/mebres/ban_infos_modif.php?ban_id='.$data['ban_id'].'" class="menulink"><strong>M</strong></a></div></td>;
        </tr>;
        <tr>;
          <td width="26" height="20"><div align="center"><a href="/echange/membres/ban_infos_delete.php?ban_id='.$data['ban_id'].'" class="menulink"><strong>S</strong></a></div></td>;
        </tr>;
        <tr>;
          <td width="26" height="20">&nbsp;</td>;
        </tr>;
        <tr>;
          <td width="71" height="20">ID</td>;
          <td width="397" height="20">'.$data['ban_id'].'</td>;
          <td width="26" height="20">&nbsp;</td>;
        </tr>;
        <tr>;
          <td width="71" height="20">Lien</td>;
          <td width="397" height="20">'.$data['ban_lien'].'</td>;
          <td width="26" height="20">&nbsp;</td>;
        </tr>;
        <tr>;
          <td width="71" height="20">Emplacement</td>;
          <td width="397" height="20">'.$data['ban_emp'].'</td>;
          <td width="26" height="20">&nbsp;</td>;
        </tr>;
        <tr>;
          <td height="20">Fond</td>;
          <td height="20">'.$data['ban_fond'].'</td>;
          <td height="20">&nbsp;</td>;
        </tr>;
        <tr>;
          <td height="20">Color1</td>;
          <td height="20">'.$data['ban_color'].'</td>;
          <td height="20">&nbsp;</td>;
        </tr>;
        <tr>;
          <td height="20">Color2</td>;
          <td height="20">'.$data['ban_color2'].'</td>;
          <td height="20">&nbsp;</td>;
        </tr>;
        <tr>;
          <td height="20">Texte</td>;
          <td height="20">'.$data['ban_txt'].'</td>;
          <td height="20">&nbsp;</td>;
        </tr>;
        <tr>;
          <td height="20">Cr&eacute;dits</td>;
          <td height="20">'.$data['ban_credits'].'</td>;
          <td height="20">&nbsp;</td>;
        </tr>;
        <tr>;
          <td height="20">affich&eacute;e</td>;
          <td height="20">votre bannière a étée affichée '.$data['ban_affiche'].' fois</td>;
          <td height="20">&nbsp;</td>;
        </tr>;
        <tr>;
          <td height="20">Affichages</td>;
          <td height="20">vous avez effectué '.$data['ban_affichage'].' avec ce compte bannière</td>;
          <td height="20">&nbsp;</td>;
        </tr>;
        <tr>;
          <td height="20">Code</td>;
          <td height="20"><iframe src="http://www.banniere-echange.fr.tc/frames/frame_ban_1.php?ban_id='.$data['ban_id'].'" name="frame_ban_1" width="500" height="100" scrolling="no" frameborder="0" hspace="0" vspace="0" id="frame_ban_1" border="0" ></iframe>;
          <p>&nbsp;</p></td>;
          <td height="20">&nbsp;</td>;
        </tr>;
      </table>;
	  </p>; 
	}

mysql_close($db);  // 6 
?>
et sa me met
Parse error: parse error, unexpected '<' in /var/www/sdc/0/8/yuu.sw/echange/membres/ban_infos.php on line 115
la ligne 115 est celle ci
	<p>;
ca c'est embettant

par yuuzhantar » 01 nov. 2005, 18:06

exact

je viens de tester
c bon

par Truc » 01 nov. 2005, 18:02

ne met pas le echo entre apostrophes !!
echo "votre lien de bannière est ".$data['ban_lien']; 

par yuuzhantar » 01 nov. 2005, 18:01

$sql="SELECT ban_id, ban_lien, ban_emp, ban_fond, ban_color, ban_color2, ban_txt, ban_credits, ban_affiche, ban_affichage FROM a_ban WHERE user_id='$id3'"; 
echo $sql; // fait un copier coller dans phpmyadmin et regarde si tu as un résultat 
$req = mysql_query($sql); 
while($data = mysql_fetch_assoc($req))
	{
	'echo "votre lien de bannière est '.$data['ban_lien'].'"';
	}
c dans cette partie qu'il y a un bug

par yuuzhantar » 01 nov. 2005, 17:49

pour l'instant sa sa marche

sa affiche sur la page
SELECT ban_id, ban_lien, ban_emp, ban_fond, ban_color, ban_color2, ban_txt, ban_credits, ban_affiche, ban_affichage FROM a_ban WHERE user_id='1'

donc c'est bon

sa viens alors de la suite avec le while

par Truc » 01 nov. 2005, 17:39

Pour voir si c'est la requete qui ne va pas teste la :wink:
deja décompose:
$sql="SELECT ban_id, ban_lien, ban_emp, ban_fond, ban_color, ban_color2, ban_txt, ban_credits, ban_affiche, ban_affichage FROM a_ban WHERE user_id=".$id3;
echo $sql; // fait un copier coller dans phpmyadmin et regarde si tu as un résultat
$req = mysql_query($sql);

par yuuzhantar » 01 nov. 2005, 17:35

déjà, apparement, sa ne vient pas du tableau car pour voir j'ai un peut modifié le code pour mettre sa
<?php 
$db = mysql_connect('sql.free.fr', 'yuu.sw', '794212');  // 1 
mysql_select_db('yuu_sw',$db);                    // 2 
$req = mysql_query("SELECT ban_id, ban_lien, ban_emp, ban_fond, ban_color, ban_color2, ban_txt, ban_credits, ban_affiche, ban_affichage FROM a_ban WHERE user_id='$id3'");          // 3 
while($data = mysql_fetch_assoc($req))
	{
	'echo "votre lien de bannière est '.$data['ban_lien'].'"';
	}

mysql_close($db);  // 6 
?>

sa doit venir de la requete car la aussi sa n'affiche rien

par yuuzhantar » 01 nov. 2005, 17:31

a, j'avais pas vu les balises php

bon, l'autre sujet est réglé, il ne reste plus que celui la

par ouckileou » 01 nov. 2005, 17:27

Si tu réglais d'abord ce sujet là avant : http://www.phpfrance.com/forums/voir_su ... 0-asc-.php

Et pour coller du code PHP tu as des balises
 plutôt que faire une citation

affichage d'infos depuis sql

par yuuzhantar » 01 nov. 2005, 17:18

bonjour

pour lister les bannières de mes visteurs, j'ai créé ce code, qui affiche des infos dans un tableau

le code est très long
<?php
$db = mysql_connect('sql.free.fr', 'xxx', 'xxx'); // 1
mysql_select_db('yuu_sw',$db); // 2
$req = mysql_query("SELECT ban_id, ban_lien, ban_emp, ban_fond, ban_color, ban_color2, ban_txt, ban_credits, ban_affiche, ban_affichage FROM a_ban WHERE user_id='$id3'"); // 3
while($data = mysql_fetch_assoc($req))
{

'<p><table width="494" height="280" border="0" cellpadding="0" cellspacing="0">';
'<tr>';
'<td colspan="2" rowspan="3"><img src="'.$data['ban_emp'].'" width="468" height="60"></td>';
'<td width="26" height="20"><div align="center"><a href="/echange/mebres/ban_infos_modif.php?ban_id='.$data['ban_id'].'" class="menulink"><strong>M</strong></a></div></td>';
'</tr>';
'<tr>';
'<td width="26" height="20"><div align="center"><a href="/echange/membres/ban_infos_delete.php?ban_id='.$data['ban_id'].'" class="menulink"><strong>S</strong></a></div></td>';
'</tr>';
'<tr>';
'<td width="26" height="20">&nbsp;</td>';
'</tr>';
'<tr>';
'<td width="71" height="20">ID</td>';
'<td width="397" height="20">'.$data['ban_id'].'</td>';
'<td width="26" height="20">&nbsp;</td>';
'</tr>';
'<tr>';
'<td width="71" height="20">Lien</td>';
'<td width="397" height="20">'.$data['ban_lien'].'</td>';
'<td width="26" height="20">&nbsp;</td>';
'</tr>';
'<tr>';
'<td width="71" height="20">Emplacement</td>';
'<td width="397" height="20">'.$data['ban_emp'].'</td>';
'<td width="26" height="20">&nbsp;</td>';
'</tr>';
'<tr>';
'<td height="20">Fond</td>';
'<td height="20">'.$data['ban_fond'].'</td>';
'<td height="20">&nbsp;</td>';
'</tr>';
'<tr>';
'<td height="20">Color1</td>';
'<td height="20">'.$data['ban_color'].'</td>';
'<td height="20">&nbsp;</td>';
'</tr>';
'<tr>';
'<td height="20">Color2</td>';
'<td height="20">'.$data['ban_color2'].'</td>';
'<td height="20">&nbsp;</td>';
'</tr>';
'<tr>';
'<td height="20">Texte</td>';
'<td height="20">'.$data['ban_txt'].'</td>';
'<td height="20">&nbsp;</td>';
'</tr>';
'<tr>';
'<td height="20">Cr&eacute;dits</td>';
'<td height="20">'.$data['ban_credits'].'</td>';
'<td height="20">&nbsp;</td>';
'</tr>';
'<tr>';
'<td height="20">affich&eacute;e</td>';
'<td height="20">votre bannière a étée affichée '.$data['ban_affiche'].' fois</td>';
'<td height="20">&nbsp;</td>';
'</tr>';
'<tr>';
'<td height="20">Affichages</td>';
'<td height="20">vous avez effectué '.$data['ban_affichage'].' avec ce compte bannière</td>';
'<td height="20">&nbsp;</td>';
'</tr>';
'<tr>';
'<td height="20">Code</td>';
'<td height="20"><p><iframe src="http://www.banniere-echange.fr.tc/frame ... id='.$data['ban_id'].'" name="frame_ban_1" width="500" height="100" scrolling="no" frameborder="0" hspace="0" vspace="0" id="frame_ban_1" border="0" ></iframe></p>';
'<p>&nbsp;</p></td>';
'<td height="20">&nbsp;</td>';
'</tr>';
'</table></p>';
}

mysql_close($db); // 6
?>
sauf que sa n'affiche rien du tout, pourtant j'ai des bannières mais ???

je vois pas ce qui ne vas pas