> Tous les forumsForum des Webmasters

 Tableaux et php xD
Statut du sujet : NON RESOLU Imprimer
 dtom99
  Posté le 28/03/2005 @ 03:33  
 Petit astucien

24 Messages
Bonjour, J'ai un petit probléme avec l'affichage( while ) de données BDD vers une page php sous forme de tableau, c'est que j'arrive pas à définir un espace afin que les colonnes soit moins espacés :<, merci a ceux qui m'aideronts ;) http://www.bskteam.3dmega.com/tempo/888/index.php Voici le code du tableau ( celui des matchs en haut a gauche ).
echo("<tr width=\"125\" cellspacing=\"1\" cellpadding=\"1\">"); echo("<td><div align=\"center\"><span class=\"dix\">$jour.$mois</span></div></td>"); echo("<td><div align=\"center\"><a href=\"wars.php?id=$idmatchs\"><span class=\"dix2\">$adversaire</span></div></td>"); echo("<td><div>"); if ($notrescore>$scoreadversaire){ echo("<table width=\"30\" border=\"0\">\n<tr>\n<td bgcolor=\"#00CC33\"><div align=\"center\"><span class=\"dix\"><font color=\"#FFFFFF\"><strong>$notrescore-$scoreadversaire</strong></font></span></div></td>\n</tr>\n</table>\n");} if ($notrescore<$scoreadversaire){ echo("<table width=\"30\" border=\"0\">\n<tr>\n<td bgcolor=\"#FF3300\"><div align=\"center\"><span class=\"dix\"><font color=\"#FFFFFF\"><strong>$notrescore-$scoreadversaire</strong></font></span></div></td>\n</tr>\n</table>\n");} if ($notrescore==$scoreadversaire){ echo("<table width=\"30\" border=\"0\">\n<tr>\n<td bgcolor=\"#0066FF\"><div align=\"center\"><span class=\"dix\"><font color=\"#FFFFFF\"><strong>$notrescore-$scoreadversaire</strong></font></span></div></td>\n</tr>\n</table>\n");}
et celui de la page entiére au cas ou :)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>bSk-gaming.net</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link title="style" type="text/CSS" rel="stylesheet" href="bsk2.css"> <?php //Fichier config connexion include("config.php"); //Verifie si on peut se connecter a la base sql $connect=mysql_connect($host,$user,$pass) or die ("Impossible de se connecter"); mysql_select_db($base, $connect) or die ("Impossible de selectionner la base de donnees"); $start=addslashes($_GET['start']); //Initialise la variable pour l'affichage par page if(!$start) {$start=0;} //Reccupere le nombre de matchs $result=mysql_query ("SELECT * FROM matchs") or die ("Impossible d'executer la requete"); $nbmatchs = mysql_num_rows($result); //Rècupère le nombre matchs gagnés, perdus, nuls $nbmatchs = mysql_num_rows($result); $matchsgagnes=0; $matchsperdus=0; $matchsnuls=0; $result=mysql_query ("SELECT * FROM matchs") or die ("Impossible d'executer la requete"); while ($row = mysql_fetch_array($result)) { $notrescore = $row ["notrescore"]; $scoreadversaire = $row ["scoreadversaire"]; if ($notrescore>$scoreadversaire){$matchsgagnes++;} if ($notrescore<$scoreadversaire){$matchsperdus++;} if ($notrescore==$scoreadversaire){$matchsnuls++;} } ?> <script language="JavaScript1.2"> function high(which2){ theobject=which2 highlighting=setInterval("highlightit(theobject)",50) } function low(which2){ clearInterval(highlighting) if (which2.style.MozOpacity) which2.style.MozOpacity=0.3 else if (which2.filters) which2.filters.alpha.opacity=25 } function highlightit(cur2){ if (cur2.style.MozOpacity<1) cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1 else if (cur2.filters&&cur2.filters.alpha.opacity<100) cur2.filters.alpha.opacity+=10 else if (window.highlighting) clearInterval(highlighting) } </script> <script language="JavaScript"> function FT_PreloadImages() { if (document.images) { if (typeof(document.FT) == 'undefined') { document.FT = new Object(); } document.FT.loaded_images = new Array(); var argc = FT_PreloadImages.arguments.length; for (i=0; i<argc; i++) { document.FT.loaded_images[i] = new Image(); document.FT.loaded_images[i].src = FT_PreloadImages.arguments[i]; } } } function msover(img,ref,desc) { if (document.images) { document.images[img].src = ref; window.status = desc; } return true; } function msout(img,ref) { if (document.images) { document.images[img].src = ref; window.status = ""; } return true; } </script> <style> ul, li, p, td, div { color: #383A3A; font-family: verdana; font-size: 11px; } a { text-decoration: none } </style> </head> <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <table width="596" border="0" align="center" cellpadding="0" cellspacing="0" style="border: 2; border-right-style: dotted; border-right-color: #E2E2E2; padding: 1"> <tr> <td width="13" height="718" rowspan="3" background="img/degrade_03.gif" bgcolor="#FFFFFF"> </td> <td width="125" rowspan="3" valign="top" bgcolor="#000020"><table width="116" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="91" colspan="2" valign="bottom"><div align="center"><img src="img/bsk_06.gif" width="122" height="71"></div></td> </tr> <tr> <td height="51" colspan="2" valign="bottom"><div align="left"><img src="img/menu_08.gif" width="125" height="23"></div> </td> </tr> <? //Affichage des matchs trier par l'affichage par page $result=mysql_query ("SELECT * FROM matchs ORDER by annee DESC, mois DESC, jour DESC, heure DESC LIMIT $start,$affmatchs") or die ("Impossible d'executer la requete"); while ($row = mysql_fetch_array($result)) { $idmatchs = $row["id"]; $adversaire = $row["adversaire"]; $pays = $row["pays"]; $type = $row ["type"]; $style = $row ["style"]; $map1 = $row ["map1"]; $map2 = $row ["map2"]; $map3 = $row ["map3"]; $notrescore = $row ["notrescore"]; $scoreadversaire = $row ["scoreadversaire"]; $jour = $row ["jour"]; $mois = $row ["mois"]; $annee = $row ["annee"]; $stats = $row ["stats"]; $commentaire = $row ["commentaire"]; echo("<tr width=\"125\" cellspacing=\"1\" cellpadding=\"1\">"); echo("<td><div align=\"center\"><span class=\"dix\">$jour.$mois</span></div></td>"); echo("<td><div align=\"center\"><a href=\"wars.php?id=$idmatchs\"><span class=\"dix2\">$adversaire</span></div></td>"); echo("<td><div>"); if ($notrescore>$scoreadversaire){ echo("<table width=\"30\" border=\"0\">\n<tr>\n<td bgcolor=\"#00CC33\"><div align=\"center\"><span class=\"dix\"><font color=\"#FFFFFF\"><strong>$notrescore-$scoreadversaire</strong></font></span></div></td>\n</tr>\n</table>\n");} if ($notrescore<$scoreadversaire){ echo("<table width=\"30\" border=\"0\">\n<tr>\n<td bgcolor=\"#FF3300\"><div align=\"center\"><span class=\"dix\"><font color=\"#FFFFFF\"><strong>$notrescore-$scoreadversaire</strong></font></span></div></td>\n</tr>\n</table>\n");} if ($notrescore==$scoreadversaire){ echo("<table width=\"30\" border=\"0\">\n<tr>\n<td bgcolor=\"#0066FF\"><div align=\"center\"><span class=\"dix\"><font color=\"#FFFFFF\"><strong>$notrescore-$scoreadversaire</strong></font></span></div></td>\n</tr>\n</table>\n");} } ?></td> </tr> <tr> <td height="51" colspan="2" valign="bottom"><div align="left"><strong><img src="img/menu_07.gif" width="125" height="23"></strong></div></td> </tr> <tr> <td width="9" height="13" valign="middle"><div align="center"><font color="#FFFFFF"></font></div></td> <td width="117" valign="middle"><font color="#A4A4BD"><strong>Home</strong></font></td> </tr> <tr> <td height="4" colspan="2" valign="top"><div align="center"><img src="img/ligne.gif" width="116" height="4"></div></td> </tr> <tr> <td height="13" valign="middle"><div align="center"><font color="#FFFFFF"></font></div> </td> <td valign="middle"><font color="#A4A4BD"><strong>Forum</strong></font></td> </tr> <tr> <td height="4" colspan="2" valign="top"><div align="center"><img src="img/ligne.gif" width="116" height="4"></div> </td> </tr> <tr> <td height="13" valign="middle"><div align="center"><font color="#FFFFFF"></font></div> </td> <td valign="middle"><font color="#A4A4BD"><strong>Roster</strong></font></td> </tr> <tr> <td height="4" colspan="2" valign="top"><div align="center"><img src="img/ligne.gif" width="116" height="4"></div> </td> </tr> <tr> <td height="13" valign="middle"><div align="center"><font color="#FFFFFF"></font></div> </td> <td valign="middle"><font color="#A4A4BD"><strong>Matches</strong></font></td> </tr> <tr> <td height="4" colspan="2" valign="top"><div align="center"><img src="img/ligne.gif" width="116" height="4"></div> </td> </tr> <tr> <td height="13" valign="middle"><div align="center"><font color="#FFFFFF"></font></div> </td> <td valign="middle"><font color="#A4A4BD"><strong>Calendar</strong></font></td> </tr> <tr> <td height="4" colspan="2" valign="top"><div align="center"><img src="img/ligne.gif" width="116" height="4"></div> </td> </tr> <tr> <td height="13" valign="middle"><div align="center"><font color="#FFFFFF"></font></div> </td> <td valign="middle"><font color="#A4A4BD"><strong>Private</strong></font></td> </tr> <tr> <td height="4" colspan="2" valign="top"><div align="center"><img src="img/ligne.gif" width="116" height="4"></div> </td> </tr> <tr> <td height="13" valign="middle"><div align="center"><font color="#FFFFFF"></font></div> </td> <td valign="middle"><font color="#A4A4BD"><strong>Contact</strong></font></td> </tr> <tr> <td height="4" colspan="2" valign="top"><div align="center"><img src="img/ligne.gif" width="116" height="4"></div> </td> </tr> <tr> <td height="13" valign="middle"><div align="center"><font color="#FFFFFF"></font></div> </td> <td valign="middle"><font color="#A4A4BD"><strong>About us</strong></font></td> </tr> <tr> <td height="4" colspan="2" valign="top"><div align="center"><img src="img/ligne.gif" width="116" height="4"></div> </td> </tr> <tr> <td height="13" valign="middle"><div align="center"><font color="#FFFFFF"></font></div> </td> <td valign="middle"><font color="#A4A4BD"><strong>Serveur</strong></font></td> </tr> <tr> <td height="4" colspan="2" valign="top"><div align="center"><img src="img/ligne.gif" width="116" height="4"></div> </td> </tr> <tr valign="bottom"> <td height="51" colspan="2"><img src="img/menu_09.gif" width="125" height="23"></td> </tr> </table> <div align="center"></div></td> <td width="13" rowspan="3" background="img/degrade_04.gif"></td> <td width="443" valign="top"><table width="413" height="788" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="82" valign="top"><table width="412" height="201" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="30" valign="bottom"><div align="right"><img src="img/refresh.jpg" width="114" height="12"></div></td> </tr> <tr> <td height="124" valign="middle"><a href="profjoq.php"><img border="0" src="screen/screen_01.jpg" style="filter:alpha(opacity=25);-moz-opacity:0.3" onMouseover="high(this)" onMouseout="low(this)" width="420" height="120"></a></td> </tr> <tr> <td height="46" valign="middle"><div align="center"></div></td> </tr> </table> <div align="right"></div></td> </tr> <tr> <td height="41" valign="top"><table width="415" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><div align="center"><strong><font color="#F510A5">@</font></strong></div> </td> <td><strong>Mise en ligne du nouveau site php :_D</strong></td> </tr> <tr> <td height="21"><font size="1"> </font></td> <td valign="top"><font color="#CCCCCC" size="1"><em>Posté par JoQ^ le 18 Mars 2005</em></font></td> </tr> <tr> <td> </td> <td valign="top"><div align="justify">Un nouveau site vient enfin d'être mis en ligne, quelques nouveautés, même beaucoup par rapport à l'ancienne version sont la.<font size="1"><FONT SIZE="1" COLOR="#FFFFFF"><font color="#CECECE"><font size="1"><font color="#828282"><BR> </font></font></font></FONT></font>La première grosse nouveauté sont les parties misent en php; news, match et le calendar. La deuxième est une toute nouvelle interface graphique entièrement exclusive =].<font size="1"><FONT SIZE="1" COLOR="#FFFFFF"><font color="#CECECE"><font size="1"><font color="#828282"><BR> <BR> </font></font></font></FONT></font>Merci à dtOm et à Odr pour le codage du php, si vous avez des remarques à propos du site, n'hésiter par à aller sur notre forum ou nous contacter sur notre channel irc (#bsk.h @ quakenet).</div></td> </tr> <tr> <td height="21" colspan="2"> </td> </tr> <tr> <td><div align="center"><strong><font color="#F510A5">@</font></strong></div> </td> <td><strong>LFET: Montée direct vers la d2!</strong></td> </tr> <tr> <td height="21"><font size="1"> </font></td> <td valign="top"><font color="#CCCCCC" size="1"><em>Posté par JoQ^ le 10 Mars 2005</em></font></td> </tr> <tr> <td> </td> <td valign="top"><div align="justify">Après un victoire satisfaisante face aux GoC, nous repartions pour un nouveau match face aux Groahrg (GT-ET) qui n'avait comme enjeux qu'une montée en d2. Petit résumé du match<font size="1"><FONT SIZE="1" COLOR="#FFFFFF"><font color="#CECECE"><font size="1"><font color="#828282"><BR> </font></font></font></FONT></font>La première map était et_beach où nous défendions en premier. Full défence de notre part sans grandes difficultés, nous passons donc allies où après quelques rushs et environ 9 minutes nous mettons les docs à la radio, les 2 points sont à nous, go to d2 ffs!<font size="1"><FONT SIZE="1" COLOR="#FFFFFF"><font color="#CECECE"><font size="1"><font color="#828282"><BR> </font></font></font></FONT></font>Nous revoilà sur supplydepot2 où malgré l'absence d'enjeux nous ne laissons rien; attaque en environ 6 minutes, temps qui ne sera pas battu par les Groahrg.<font size="1"><FONT SIZE="1" COLOR="#FFFFFF"><font color="#CECECE"><font size="1"><font color="#828282"><BR> </font></font></font></FONT></font><font size="1"><FONT SIZE="1" COLOR="#FFFFFF"><font color="#CECECE"><font size="1"><font color="#828282"><BR> </font></font></font></FONT></font>Après un piteuse saison en d2, nous redressons la barre (;]) et finissons la saison sans aucune défaite, gg à tout nos adversaires qui ont été sympa et fair play soit: les AL-U, les e., les GoC, les Groahrg, les SPA et les WnS.</div> </td> </tr> <tr> <td height="21" colspan="2"> </td> </tr> <tr> <td width="15"><div align="center"><strong><font color="#F510A5">@</font></strong></div></td> <td width="398"><strong>Le finale en d3b?!</strong></td> </tr> <tr> <td height="21"><font size="1"> </font></td> <td valign="top"><font color="#CCCCCC" size="1"><em>Posté par JoQ^ le 03 Mars 2005</em></font></td> </tr> <tr> <td> </td> <td valign="top"><div align="justify">Le match se déroulant hier soir et comptant pour la 6ième et avant dernière journée avait comme enjeux une option très significative pour la montée en d2 LFET.<font size="1"><FONT SIZE="1" COLOR="#FFFFFF"><font color="#CECECE"><font size="1"><font color="#828282"><BR> </font></font></font></FONT></font>Nous nous sommes brillament imposée 4-0 face aux GoC sur goldrush et svarvadel. Le dernier match de la saison se jouera le 9 mars face aux GT-ET contre qui nous devrons au minimum rapporté 1 point.</div></td> </tr> </table></td> </tr> <tr> <td height="25" valign="top"> </td> </tr> <tr> <td height="29" valign="top"> </td> </tr> </table></td> </tr> <tr> <td valign="top"> </td> </tr> <tr> <td height="19" valign="top"> </td> </tr> </table> <? mysql_close(); // Déconnexion de MySQL ?> </body> </html>
 Afficher le profil de dtom99Envoyer un message privé à dtom99
 
 
Publicité
 El Konkonbré M@squed  Posté le 28/03/2005 à 12:49  
Petit astucien

355 Messages
Salut Dtom. Pas trop l'temps de regarder ton problème, mais par contre, vires tous tes <div align="center">....</div> et met ça dans tes <td> Ex [code]echo("<td><div align=\"center\"><span class=\"dix\">$jour.$mois</span></div></td>"); echo("<td><div align=\"center\"><a href=\"wars.php?id=$idmatchs\"><span class=\"dix2\">$adversaire</span></div></td>");[/code] par [code]echo("<td align=\"center\"><span class=\"dix\">$jour.$mois</span></td>"); echo("<td align=\"center\"><a href=\"wars.php?id=$idmatchs\"><span class=\"dix2\">$adversaire</span></td>");[/code] et en collant le class dans le <td>, cela soulagera encore du code [code]echo("<td align=\"center\" class=\"dix\">$jour.$mois</td>"); echo("<td align=\"center\" class=\"dix2\"><a href=\"wars.php?id=$idmatchs\">$adversaire</a></td>");[/code] Et d'ailleur ci-dessus, je ne vois pas ta balise de fermeture </a> (chui p't'être mal réveillé ;) dans le dernier je l'ai ajouté en gras) Et n'hésite pas à recréer un style supplémentaire, pour alléger encore ton code ex: .dix3 { /* ici le code de ta class dix */ color: "#FFFFFF; font-weight: bold; } Cela t'éviteras de mettre : <font color=\"#FFFFFF\"><strong>$notrescore-$scoreadversaire</strong></font> Sinon pour ton problème, je ne sais pas si tu as testé, mais descend la valeur tr width=\"125\". Tchao.

Modifié par El Konkonbré M@squed le 28/03/2005 12:53
Afficher le profil de El Konkonbré M@squedEnvoyer un message privé à El Konkonbré M@squed
 Revenir en haut de la page
 El Konkonbré M@squed  Posté le 28/03/2005 à 13:56  
Petit astucien

355 Messages
Bon ben j'viens de zieuter vite fait la source de ta page dans dream (celle de ton site), et apparemment c'est ton logo Last Match, qui fait 125px de largeur, qui t'empêcheras de rétrécir ton tableau qui te pose problème. Par contre ouiiilllle, j'ai vu que beaucoups de tes attributs ne sont pas encadrés de quotes (peut-être pas la dernière mise à jour sur ton site, puisque la source que tu files est mieux ;) ). De même si par la suite tu t'intéresses à la validation xhtml par exemple, il faut tout mettre en minuscule (entre autres ;) ). Fait ça de suite parce que sinon tu verras, que par la suite tu passeras un milliards de fois plus de temps à rectifier des centaines de petites erreurs à droite à gauche (j'ai testé, alors je te le dit ;) et je suis encore dans des millions de rectifs :( ) Re...

Modifié par El Konkonbré M@squed le 28/03/2005 14:02
Afficher le profil de El Konkonbré M@squedEnvoyer un message privé à El Konkonbré M@squed
 Revenir en haut de la page
 dtom99  Posté le 28/03/2005 à 17:04  
Petit astucien

24 Messages
merci, mais le problème vien précisement du tableau de match qui fait plus de 125 pix, a cause de l'espacement des colonnes :(, sinon non je peut pas pas mettre dans style dix, la couleur du fond, car il me faudrais faire 3 style ( un pour le fond vert, bleu et rouge ).
Afficher le profil de dtom99Envoyer un message privé à dtom99
 Revenir en haut de la page
 dtom99  Posté le 28/03/2005 à 19:44  
Petit astucien

24 Messages
up :(
Afficher le profil de dtom99Envoyer un message privé à dtom99
 Revenir en haut de la page
 dtom99  Posté le 29/03/2005 à 14:39  
Petit astucien

24 Messages
up :p
Afficher le profil de dtom99Envoyer un message privé à dtom99
 Revenir en haut de la page
 dtom99  Posté le 30/03/2005 à 21:39  
Petit astucien

24 Messages
up ( dsl mais c'est important pour moi, j'arrive tjrs pas a bien modifier )
Afficher le profil de dtom99Envoyer un message privé à dtom99
 Revenir en haut de la page
Haut de la page 
Inscrivez-vous !
- Posez vos questions

- Résolvez vos problèmes

- Aidez les autres

- Participez et créez vos discussions

- Dialoguez en privé avec d'autres membres

- Suivez vos sujets préférés

- Affichez les signatures des membres

TOUT EST GRATUIT !

Je crée mon compte



Vous avez besoin d'aide ?
Des centaines d'experts sont à votre disposition sur les forums PC Astuces pour vous aider gratuitement, 24h/24, 7j/7.

Les derniers sujets résolus !
 

 > Tous les forumsForum des Webmasters

 
Forum PC Astuces© 1997-2008 WebastucesAller en haut de la page