我在这里有一个名为 tb_user 的动态表,其列 region_id 和 Institute_id 并且两个 id 都是另一个表 tb_region(具有列 region_name 和 region_id)和 tb_institute(列 institut_id 和 Institute_name)的主键。我想查看 region_name 和 Institute_name 而不是 ID。
我用过这个 php 脚本
<?php echo $row_institute['institution_name']; ?>
并查询以收集 tb_institute 的数据
mysql_select_db($database_connection_ched, $connection_ched);
$query_institution = "SELECT institute_id, institute_name FROM tb_institute";
$institution = mysql_query($query_institution, $connection_ched) or die(mysql_error());
$row_institution = mysql_fetch_assoc($institution);
$totalRows_institution = mysql_num_rows($institution);
但似乎没有显示正确的id名称。
我用来收集数据的查询:
mysql_select_db($database_connection_ched, $connection_ched);
$query_notification = sprintf("SELECT * FROM tb_user WHERE status = 'inactive' ORDER BY date_register ASC", GetSQLValueString($colname_notification, "text"));
$query_limit_notification = sprintf("%s LIMIT %d, %d", $query_notification, $startRow_notification, $maxRows_notification);
$notification = mysql_query($query_limit_notification, $connection_ched) or die(mysql_error());
$row_notification = mysql_fetch_assoc($notification);
if (isset($_GET['totalRows_notification'])) {
$totalRows_notification = $_GET['totalRows_notification'];
} else {
$all_notification = mysql_query($query_notification);
$totalRows_notification = mysql_num_rows($all_notification);
}
$totalPages_notification = ceil($totalRows_notification/$maxRows_notification)-1;