i tüm gönüllüler depolayan bir tablo var, ve her gönüllü olayı çalışmak için uygun bir mekan tahsis edilecektir. tüm mekanları depolayan bir tablo var.
Bu sütun 'venue_id' içine gönüllünün uygun mekan atama saklar
table: venues columns: id, venue_name
table: volunteers_2009 columns: id, lname, fname, etc.., venue_id
Burada gönüllü listesini görüntülemek için fonksiyon ve i yaşıyorum sorunu kendi mekan atama göstermektir. Bu i lüzum uygun bilgi kapmak için iki tablo birlikte katıldı ilk kez, çünkü ben, mysql katılır çok daha hiç çalışmamış.
so i want it to go to the volunteers_2009 table, grab the venue_id, go to the venues table, match up volunteers_2009.venue_id to venues.id, to display venues.venue_name, so in the list it will display the volunteer's venue assignment.
<?php
// -----------------------------------------------------
//it displays appropriate columns based on what table you are viewing
function displayTable($table, $order, $sort) {
$query = "select * from $table ORDER by $order $sort";
$result = mysql_query($query);
// volunteer's venue query
$query_venues = "SELECT volunteers_2009.venue_id, venues.venue_name FROM volunteers_2009 JOIN venues ON volunteers_2009.venue_id = venues.id";
$result_venues = mysql_query($query_venues);
if($_POST) { ?>
<table id="box-table-a">
<tr>
<th>Name</th>
<?php if($table == 'maillist') { ?>
<th>Email</th>
<?php } ?>
<?php if($table == 'volunteers_2008' || $table == 'volunteers_2009') { ?>
<th>Comments</th>
<?php } ?>
<?php if($table == 'volunteers_2009') { ?>
<th>Interests</th>
<th>Venue</th>
<?php } ?>
<th>Edit</th>
</tr>
<tr>
<?php
while($row = mysql_fetch_array($result))
{
$i = 0;
while($i <=0)
{
print '<td>'.$row['fname'].' '.$row['lname'].'</td>';
if($table == 'maillist') {
print '<td><a href="mailto:'.strtolower($row['email']).'">'.strtolower($row['email']).'</a></td>';
}
if($table == 'volunteers_2008' || $table == 'volunteers_2009') {
print '<td><small>'.substr($row['comments'], 0, 32).'</small></td>';
}
if($table == 'volunteers_2009') {
print '<td><small>1) '.$row['choice1'].'<br>2) '.$row['choice2'].'<br>3) '.$row['choice3'].'</small></td>'; ?>
<td> <?php
if($row_venues['venue_name'] != '') {
// print venue assigned
print $row_venues['venue_id'].' '.$row_venues['venue_name'].' ';
} else { print 'No Venue Assigned'; } ?>
</td> <?php
} ?>
<td><a href="?mode=upd&id=<?= $row[id] ?>&table=<?= $table ?>">Upd</a> / <a href="?mode=del&id=<?= $row[id] ?>&table=<?= $table ?>" onclick="return confirm('Are you sure you want to delete?')">Del</a></td> <?php
$i++;
}
print '</tr>';
}
print '</table>';
}
}
// -----------------------------------------------------
?>