PHP で MySQL クエリから行数を取得できません。
テスト ページと PHP コードへのリンクは次のとおりです。
<?php
$con=* TESTED AND WORKING *
// Check connection
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$retDiv = "";
$counter = 0;
$result = mysqli_query($con,"SELECT * FROM `store` ORDER BY `num` DESC ");
$num_rows = mysql_num_rows($result);
while($row = mysqli_fetch_array($result))
{
if ($counter>=5)
{
break;
}
else
{
$retDiv = "<div id=\"hs" . $row['num'] . "\" class=\"store-item " . $row['Artist'] . "\">\n";
$retDiv = $retDiv . "<div id=\"". $row['Release'] . "-title\" class=\"album-title\">\n";
$retDiv = $retDiv . "<h1 align=\"center\" style=\"text-transform:uppercase;\">" . $row['Release'] . "</h1></br>\n";
$retDiv = $retDiv . "<h3 align=\"center\">" . $row['ReleaseName'] . "</h3>\n";
$retDiv = $retDiv . "</div>\n";
$retDiv = $retDiv . "<div id=\"" . $row['Release'] . "-description\" class=\"description\">\n";
$retDiv = $retDiv . "<table width=\"100%\">\n";
$retDiv = $retDiv . "<td width=\"50%\" style=\"padding-left:57px;padding-right:57px;padding-top:57px;padding-bottom:20px;\">\n";
$retDiv = $retDiv . "<a id=\"" . $row['Release'] . "DivLink\" href=\"javascript:;\" onmousedown=\"toggleDivStore('" . $row['Release'] . "-expand','" . $row['Release'] . "DivLink','" . $row['Release'] . "','" . $row['Release'] . "b','" . $row['Release'] . "')\"><img name=\"" . $row['Release'] . "-art\" src = \"images/" . $row['Release'] . ".jpg\" class=\"album-art\" onmouseover=\"this.src='images/" . $row['Release'] . "b.jpg'\" onmouseout=\"this.src='images/" . $row['Release'] . ".jpg'\"></a>\n";
$retDiv = $retDiv . "<td width=\"50%\" style=\"padding:20px;padding-top:0px;padding-bottom:0px;padding-left:0px;\">\n";
$retDiv = $retDiv . "<p style=\"\">" . $row['Description'] . "</p>\n";
$retDiv = $retDiv . "</td>\n";
$retDiv = $retDiv . "</table>\n";
$retDiv = $retDiv . "</div>\n";
$retDiv = $retDiv . "<div class=\"album-expand\" id=\"RELEASE-expand\" style=\"display:none;\">\n";
$retDiv = $retDiv . "</div>\n";
$retDiv = $retDiv . "<div =\"" . $row['Release'] . "PaypalContainer\" class=\"album-paypal-container\">\n";
$retDiv = $retDiv . $row['Paypal1'];
$retDiv = $retDiv . "</div>\n";
$retDiv = $retDiv . "</div>\n";
echo $retDiv;
}
$counter = $counter+1;
}
echo "<div id=\"retNum\"><script type=\"text/javascript\">numReleases =" . $num_rows . ";numPages=Math.ceil(numReleases/5)-1;</SCRIPT></div>";
mysqli_close($con);
Javascriptに関して行数$num_rows
を返す方法は?retNum