Recupération valeurs dans array et inserer dans tableau HTML

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 : Recupération valeurs dans array et inserer dans tableau HTML

Re: Recupération valeurs dans array et inserer dans tableau

par sirakawa » 01 août 2014, 13:48

iL NE SUFFIT PAS DE créer le PDO, encore faut-il le consulter et pas en faisant un truc d=comme tu fais
$bdd = NEW PDO('mysql:host=localhost;dbname=server_statut','root','', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
il faut un entre autres un select ...

ici:
$url="http://aventureclub-airlines.fr/whazzup/whazzup.txt";
$file = file($url);
var_dump($file); die(); //pour y voir plus clair

Re: Recupération valeurs dans array et inserer dans tableau

par DenisACF01 » 01 août 2014, 13:13

juste une question es-ce que vous pouvez vérifié mon code au complet pour savoir si il y a pas d'erreur :(
sur tout dans mon tableau.html?

Re: Recupération valeurs dans array et inserer dans tableau

par xTG » 01 août 2014, 13:03

if (is_array($tab))

foreach ($tableau as $ligne)
tab ou tableau ? A un moment il faut choisir. ;)

Re: Recupération valeurs dans array et inserer dans tableau

par DenisACF01 » 01 août 2014, 12:58

j'ai modifié et j'ai cette erreur maintenat:

[codeNotice: Undefined variable: tab in D:\Program Files ][/code]

Code : Tout sélectionner

if (is_array($tab)) foreach ($tableau as $ligne) { $vCallsign = $ligne[2]; }

Re: Recupération valeurs dans array et inserer dans tableau

par DenisACF01 » 01 août 2014, 12:41

sa me retourne une erreur

Code : Tout sélectionner

foreach ($Online_Pilotes as $ligne) { $vCallsign = $ligne[0]; }
Notice: Undefined variable: Online_Pilotes in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 425
Warning: Invalid argument supplied for foreach() in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 425

Re: Recupération valeurs dans array et inserer dans tableau

par sirakawa » 01 août 2014, 12:12

A toutes les lignes la valeur cherchée est l'élément 0 de la ligne:
foreach ($tableau as $ligne)
{
$vbleu = $ligne[0];
}

Recupération valeurs dans array et inserer dans tableau HTML

par DenisACF01 » 01 août 2014, 11:46

Bonjour,
dans mon array
array (size=3)
0 =>
array (size=4)
0 => string 'ACF01' (length=5)
1 => string 'Denis BOUET' (length=14)
2 => string 'OMDB' (length=4)
3 => string 'LFPG' (length=4)
1 =>
array (size=4)
0 => string 'ACF13' (length=5)
1 => string 'Jean-louis FIR' (length=16)
2 => string 'GOOY' (length=4)
3 => string 'GMMN' (length=4)
2 =>
array (size=4)
0 => string 'ACF73' (length=5)
1 => string 'Claude MOUTIER' (length=16)
2 => string 'GOOY' (length=4)
3 => string 'GMMN' (length=4)
j'aimerais récupérer le texte en Bleu pour l'affiché dans un tableau .HTML et je ne sais pas du tout comment faire même en cherchant sur le net.
mon code complet:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="fr" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<!-- #BeginEditable "doctitle" -->
<title>Online Pilotes</title>
<!-- #EndEditable -->
<style type="text/css">
.style1 {
border: 5px solid #000000;
}
.style2 {
text-align: center;
font-size: small;
color: #00FF00;
background-color: #000000;
border-left-color: #A0A0A0;
border-right-color: #C0C0C0;
border-top-color: #A0A0A0;
border-bottom-color: #C0C0C0;
}
.style3 {
text-align: center;
font-size: small;
background-color: #66FF99;
white-space: nowrap;
font-weight: normal;
}
.style4 {
font-size: small;
background-color: #66FF99;
white-space: nowrap;
font-weight: normal;
}
.style6 {
font-size: xx-small;
text-align: center;
background-color: #0000CC;
}
.style7 {
font-size: xx-small;
text-align: center;
color: #FFFF99;
background-color: #0000CC;
}
.style8 {
font-size: small;
color: #FFFFFF;
background-color: #0000CC;
font-family: QualityWings146_EICAS;
font-weight: bold;
}
.style11 {
font-size: small;
text-align: center;
background-color: #0000CC;
}
.style12 {
font-size: x-small;
text-align: center;
color: #FFFFFF;
background-color: #0000CC;
font-family: QualityWings146_EICAS;
}
.style13 {
font-size: xx-small;
text-align: center;
background-color: #0000CC;
font-family: QualityWings146_EICAS;
}
.style15 {
text-align: center;
color: #FFFF99;
border-width: 0;
background-color: #000000;
white-space: nowrap;
}
.style18 {
font-size: xx-small;
color: #FFFFFF;
background-color: #0000CC;
}
.style19 {
font-size: xx-small;
color: #FFFFFF;
background-color: #0000CC;
white-space: nowrap;
}
.style20 {
font-size: small;
color: #FFFFFF;
background-color: #0000CC;
font-family: QualityWings146_EICAS;
font-weight: bold;
white-space: nowrap;
}
.style21 {
font-size: small;
text-align: center;
color: #FFFFFF;
background-color: #0000CC;
font-family: QualityWings146_EICAS;
font-weight: normal;
white-space: nowrap;
}
.style22 {
font-size: x-small;
color: #FFFFFF;
background-color: #0000CC;
font-family: QualityWings146_EICAS;
}
.style23 {
font-size: x-small;
color: #FFFFFF;
background-color: #0000CC;
font-family: QualityWings146_EICAS;
font-weight: bold;
white-space: nowrap;
}
.style24 {
border: 5px solid #000000;
background-color: #FFFFCC;
}
.style25 {
white-space: nowrap;
border-width: 1px;
}
.style26 {
font-size: small;
text-align: center;
color: #FFFFFF;
background-color: #0000CC;
font-family: QualityWings146_EICAS;
}
.style27 {
font-size: small;
color: #FFFFFF;
background-color: #0000CC;
font-family: QualityWings146_EICAS;
vertical-align: middle;
text-align: center;
}
.style28 {
margin-left: 16px;
}
.style29 {
font-weight: bold;
border-left-color: #A0A0A0;
border-right-color: #C0C0C0;
border-top-color: #A0A0A0;
border-bottom-color: #C0C0C0;
background-color: #000000;
font-size: medium;
}
.style30 {
color: #00FF00;
font-size: medium;
border-left-color: #A0A0A0;
border-left-width: 0;
border-right-color: #C0C0C0;
border-right-width: 0;
border-top-color: #A0A0A0;
border-top-width: 0;
border-bottom-color: #C0C0C0;
border-bottom-width: 0;
background-color: #000000;
}
.style32 {
font-size: small;
color: #FFFFFF;
background-color: #0000CC;
font-family: QualityWings146_EICAS;
font-weight: normal;
white-space: nowrap;
}
.style33 {
font-size: medium;
font-weight: bold;
background-color: #000000;
}
.style34 {
font-size: medium;
background-color: #000000;
}
</style>
<meta content="2" name="ACF01" />
</head>

<body>

<table cellpadding="0" cellspacing="0" class="style24" style="float: left" align="left">
<caption></caption>
<tr>
<td style="width: 252px">

<table class="style1" style="height: 325px; float: none; width: 332px;">
<tr>
<th class="style15" colspan="3" style="height: 31px">
<div>
</div>
<span class="style34">&nbsp;</span><span class="style30" style="height: 31px">Online Controleurs</span></th>
</tr>
<tr>
<th class="style3" style="height: 9px">ATC</th>
<th class="style3" style="width: 152px; height: 9px;">Name</th>
<th class="style3" style="width: 70px; height: 9px;">Fréquency</th>
</tr>
<tr>
<th class="style21" style="width: 89px">&nbsp;</th>
<th class="style21" style="width: 152px">&nbsp;</th>
<th class="style21" style="width: 70px">&nbsp;</th>
</tr>
<tr>
<th class="style32" style="width: 89px">&nbsp;</th>
<th class="style32" style="width: 152px">&nbsp;</th>
<th class="style32" style="width: 70px">&nbsp;</th>
</tr>
<tr>
<th class="style32" style="width: 89px">&nbsp;</th>
<th class="style32" style="width: 152px">&nbsp;</th>
<th class="style32" style="width: 70px">&nbsp;</th>
</tr>
<tr>
<th class="style32" style="width: 89px">&nbsp;</th>
<th class="style32" style="width: 152px">&nbsp;</th>
<th class="style32" style="width: 70px">&nbsp;</th>
</tr>
<tr>
<th class="style32" style="width: 89px">&nbsp;</th>
<th class="style32" style="width: 152px">&nbsp;</th>
<th class="style32" style="width: 70px">&nbsp;</th>
</tr>
<tr>
<th class="style23" style="width: 89px; height: 29px;"></th>
<th class="style23" style="width: 152px; height: 29px;"></th>
<th class="style23" style="width: 70px; height: 29px;"></th>
</tr>
<tr>
<th class="style32" style="width: 89px">&nbsp;</th>
<th class="style32" style="width: 152px">&nbsp;</th>
<th class="style32" style="width: 70px">&nbsp;</th>
</tr>
<tr>
<th class="style23" style="width: 89px; height: 20px;"></th>
<th class="style23" style="width: 152px; height: 20px;"></th>
<th class="style23" style="width: 70px; height: 20px;"></th>
</tr>
<tr>
<th class="style20" style="width: 89px; height: 18px;"></th>
<th class="style8" style="width: 152px; height: 18px;"></th>
<th class="style8" style="width: 70px; height: 18px;"></th>
</tr>
<tr>
<th class="style19" style="width: 89px; height: 20px;"></th>
<th class="style18" style="width: 152px; height: 20px;"></th>
<th class="style18" style="width: 70px; height: 20px;"></th>
</tr>
</table>

<table class="style1" style="width: 332px; height: 383px">
<tr>
<td class="style2" colspan="6" style="height: 17px">
<span class="style29" style="height: 31px">Online</span><span class="style33"> Pilotes</span></td>
</tr>
<tr>
<th class="style4" style="height: 9px">Pays</th>
<th class="style3" style="height: 9px">Callsign</th>
<th class="style3" style="height: 9px; width: 110px;">Name</th>
<th class="style3" style="height: 9px">Départs</th>
<th class="style3" style="height: 9px">Arrivées</th>
<th class="style3" style="height: 9px; width: 26px;">FS</th>
</tr>
<tr>
<td class="style11" style="height: 17px">
<img alt="" height="11" src="http://aventureclub-airlines.fr/ImageAC ... aux/fr.png" width="16" /></td>
<td class="style26" style="height: 17px">&nbsp;</td>
<td class="style26" style="height: 17px; width: 110px;">&nbsp;</td>
<td class="style27" style="height: 17px">&nbsp;</td>
<td class="style26" style="height: 17px">§</td>
<td class="style26" style="height: 17px; width: 26px;">&nbsp;</td>
</tr>
<tr>
<td class="style6" style="height: 17px">
&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 110px;">&nbsp;</td>
<td class="style22" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 26px;">&nbsp;</td>
</tr>
<tr>
<td class="style13" style="height: 17px">
&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 110px;">&nbsp;</td>
<td class="style22" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 26px;">&nbsp;</td>
</tr>
<tr>
<td class="style13" style="height: 17px">
&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 110px;">&nbsp;</td>
<td class="style22" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 26px;">&nbsp;</td>
</tr>
<tr>
<td class="style13" style="height: 17px">
&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 110px;">&nbsp;</td>
<td class="style22" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 26px;">&nbsp;</td>
</tr>
<tr>
<td class="style13" style="height: 17px">
&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 110px;">&nbsp;</td>
<td class="style22" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 26px;">&nbsp;</td>
</tr>
<tr>
<td class="style13" style="height: 17px">
&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 110px;">&nbsp;</td>
<td class="style22" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 26px;">&nbsp;</td>
</tr>
<tr>
<td class="style13" style="height: 17px">
&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 110px;">&nbsp;</td>
<td class="style22" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 26px;">&nbsp;</td>
</tr>
<tr>
<td class="style13" style="height: 17px">
&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 110px;">&nbsp;</td>
<td class="style22" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 26px;">&nbsp;</td>
</tr>
<tr>
<td class="style13" style="height: 17px">
&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 110px;">&nbsp;</td>
<td class="style22" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px">&nbsp;</td>
<td class="style12" style="height: 17px; width: 26px;">&nbsp;</td>
</tr>
<tr>
<td class="style13" style="height: 15px">
</td>
<td class="style7" style="height: 15px"></td>
<td class="style7" style="height: 15px; width: 110px;"></td>
<td class="style22" style="height: 15px"></td>
<td class="style12" style="height: 15px"></td>
<td class="style12" style="height: 15px; width: 26px;"></td>
</tr>
</table>

</td>
<th class="style25" valign="top">
<iframe src="http://www.dafsim.com/map/?va=-Aventure ... tput=embed" width="692" height="698" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="style28"></iframe>
</th>
</tr>
</table>

</body>

</html>










<HEAD>
<meta http-equiv='refresh' content='60;url='http://localhost/Server_Statut.php/'>

</HEAD>



<?php


$bdd = NEW PDO('mysql:host=localhost;dbname=server_statut','root','', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));





$url="http://aventureclub-airlines.fr/whazzup/whazzup.txt";
$file = file($url);
$connect = array();
foreach ($file as $line) {
$line = trim($line);
if(preg_match("/([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)\:([^:]+)/", $line, $matches )){
$connect[] = array($matches[2], $matches[3], $matches[12], $matches[14] );
}



}



echo "<pre>"; var_dump($connect); echo "</pre>";




?>

Merci pour votre aide