为什么这只印刷了第一个网站的具体内容,而另外2个网站却没有这样做?
<?php
echo NPSIN Data will be here soon! ;
// connect to DB
$dbhost = localhost ;
$dbuser = root ;
$dbpass = root ;
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ( Error connecting to DB );
$dbname = npsin ;
mysql_select_db($dbname);
// get number of sites
$query = select count(*) from sites ;
$result = mysql_query($query) or die ( Query failed: . mysql_error());
$resultArray = mysql_fetch_array($result);
$numSites = $resultArray[0];
echo "<br><br>";
// get all sites
$query = select site_name from sites ;
$result = mysql_query($query);
// get site content
$query2 = select content_name, site_id from content ;
$result2 = mysql_query($query2);
// get site files
// print info
$count = 1;
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
echo "Site $count: ";
echo "$row[0]";
echo "<br>";
$contentCount = 1;
while ($row2 = mysql_fetch_array($result2, MYSQL_NUM)) {
$id = $row2[1];
if ($id == ($count - 1)) {
echo "Content $contentCount: ";
echo "$row2[0]";
echo "<br>";
}
$contentCount++;
}
$count++;
}
?>