sql语句或while循环绘制空白

时间:2014-04-06 17:51:42

标签: php mysql sql mysqli

下面的代码应填充大约7个项目的列表,但没有任何内容显示。任何人都可以告诉我错误在哪里,也许在SQL语句中?感谢

<?php
$page_title = 'View Your Sites';
include ('includes/header.html');
include ('includes/functions.php');
include ('includes/config.inc.php');
if (isset($_GET['id']) && is_numeric($_GET['id'])){
    $id = $_GET['id'];
} elseif (isset($_POST['id']) && is_numeric($_POST['id'])) {
    $id = $_POST['id'];
} else {
    echo '<p class="error">This page has been accessed in error.</p>';
    include ('includes/footer.html');
    exit();
}
if (isset($_SESSION['UserID'])){
require (MYSQL);
$w = "SELECT s.SiteTypeID, s.SiteType, u.url FROM sitetypes AS s LEFT JOIN sites AS u USING (SiteTypeID) WHERE UserID=$id";
$k = mysqli_query($dbc, $w)or trigger_error("Query: $w\n<br />mysqli Error: " . mysqli_error($dbc));
if (mysqli_num_rows($k) == 1){
while ($row33 = mysqli_fetch_array($k, MYSQLI_ASSOC)){
    echo '<table border="0"><th>Site Type</th><th>URL</th><tr><td>' . $row33['SiteType'] . '</td><td>' . $row33['url'] .'</td></tr>';
}
echo '</table>';
}
}

include ('includes/footer.html');
?>

0 个答案:

没有答案