<?php
$player[] = array();
$team_id = $_SESSION['tid'];
$team_pids = $con->prepare("SELECT p_id FROM players_to_team WHERE t_id = ?");
$team_pids->bindParam(1,$team_id);
$team_pids->execute();
while($info = $team_pids->fetch(PDO::FETCH_ASSOC))
{
$player[] = $info['p_id'];
echo $info['p_id'];
}
$pl_1 = $player[0];
.
.
.
$pl_10 = $player[9];
echo $player[0]; //notice here
echo $pl_1; //notice here
?>
<table>
$query = $con->prepare("SELECT role,name,value FROM players WHERE p_id = '".$pl_1."'");
// notice here
$query->execute();
while($result = $query->fetch(PDO::FETCH_ASSOC))
{
echo "<tr>";
echo "<td>".$result['role']."</td>";
echo "<td>".$result['name']."</td>";
echo "<td>".$result['value']."</td>";
}
?>
</tr>
</table>
$ info dizisi eklendiğinde, iyi çalışıyor, ancak $ player dizisi veya $ pl_1 değişkenini veya $ result dizi değerlerini eklediğimde Not ... Dizgi dönüştürme dizisi o/p gösterilmez. neden?uyarı: dize dönüştürme dizisi php için
iki dizide echo' kullanımı print_r 'bir string.Instead değildir, çünkü ($ oynatıcısı [0]); ve print_r ($ pl_1); diziyi görmek için. –
değişken değişkenlerinizin kodunuz aracılığıyla daha iyi anlaşılması için TYPE değişkenini ve içeriğinin yanı sıra içeriği görmek için herhangi bir değişken üzerinde [var_dump] (http://php.net/var_dump) kullanabilirsiniz. arasında – Latheesan
olası yinelenen [Referans -? Bu hata PHP ne demek] (http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – naththedeveloper