php - Reading from MySQL database won't work -
$query = mysql_query("select hour, team1, team2, goalsteam1, goalsteam2, competition `matches` `date`='". $daterow['date'] ."'"); while($row = mysql_fetch_array($query)){ $hour = substr($row['hour'],0,5); $teamemblem = mysql_query("select emblem `teams` `team`='".$row['team1']."'"); $teamemblemrow = mysql_fetch_assoc($teamemblem); echo ' <tr class="teamtable"> <td style="width:60px; font-size:11px;">'.$hour.'</td> <td style="width:145px; font-size:11px;"><img width=24px height=24px src='.$teamemblemrow['teamemblem'].'/></td> <td style="width:15px; font-size:11px;">'.$row['goalsteam1'].'</td> <td style="width:15px; font-size:11px;">'.$row['goalsteam2'].'</td> <td style="width:145px; font-size:11px;">'.$row['team2'].'</td> <td style="width:120; font-size:11px;">'.$row['competition'].'</td> </tr>'; }
i tried everything, emblem part won't work. refuses read database. thing printing $row['team1']
works, don't why won't read..
any help?
in query select :
select emblem `teams` where...
but in code refer after as:
$teamemblemrow['teamemblem']
which it? emblem
or teamemblem
?
when return assoc array, need make sure refer elements same name. if want use different name, can modify query bring field different name this:
select emblem teamemblem `teams` where...
which means can refer assoc array returned via y ou have in code @ moment.
edit: additionally, using old mysql_*
functions. should have read of question , upgrade code better functions.
Comments
Post a Comment