我在数据库上有一个选择,如下所示:
$result = mysql_query("
SELECT dat_eb_registrants.id, dat_eb_registrants.first_name,
dat_eb_registrants.last_name, dat_eb_registrants.email, dat_eb_registrants.comment,
dat_eb_registrants.amount, dat_eb_registrants.published,
dat_eb_registrants.transaction_id, dat_eb_registrants.register_date,
dat_eb_field_values.field_value
FROM dat_eb_registrants LEFT JOIN dat_eb_field_values
ON dat_eb_registrants.id=dat_eb_field_values.registrant_id
WHERE dat_eb_field_values.field_id='53' AND `event_id` >= 20 AND `event_id` <= 25
ORDER BY $sort $ascdsc
");
它会显示在一个 html 表中,如下所示: echo " ID First name Last name Email Comment Value1 Value2 Value3 ";
而 ($row = mysql_fetch_row($result)) {
echo "<tr>";
echo "<td>" . $row[0] . "</td>";
echo "<td>" . $row[1] . "</td>";
echo "<td>" . $row[2] . "</td>";
echo "<td>" . $row[3] . "</td>";
echo "<td>" . $row[4] . "</td>";
echo "<td>" . $row[9] . "</td>";
echo "<td>" . $row[?] . "</td>";
echo "<td>" . $row[?] . "</td>";
echo "</tr>";
echo "</table>";
}
现在,前 4 个值可以正确显示,就像第 5 个一样,但是第 6 个和第 7 个呢?它们没有被 MYSQL 调用,因为它们dat_eb_field_values.field_value
只被调用一次,并且被赋值为 WHERE dat_eb_field_values.field_id='53
如何使用数据库中的其他值完成表格?
在此先感谢,劳伦特