我已经完成了显示在我的数据库中找到的所有条目的 PHP 并且它有效!!!在 wamp 但是当我用 xampp 在 skul 打开它时..
Warning: mysql_num_rows() expects parameter 1 to be resource
我不知道问题是什么,。
$connect = mysql_connect('localhost','root','') or die(mysql_error());
$select = mysql_select_db('mis_library',$connect) or die(mysql_error());
$result=mysql_query('SELECT book FROM Catalog') or die(mysql_error());;
$total=mysql_num_rows($result); <<<<<<<<<<<<<<<THIS PART! ! ! ! ! !
echo "<div style=font-family:calibri;font-size:20px;font-weight:bold;>There are $total Available Entries.</div><br />";
echo "<div style=font-family:calibri;font-size:15px;font-weight:bold;margin-top:-10px;>Select some from the following. . .</div><br />";
echo "<div style=overflow-y:auto;overflow-x:hidden;height:210px; >";
$i=0;
while ($row=mysql_fetch_row($result))
{
foreach ($row as $field)
$get=mysql_query("SELECT b_total, b_os FROM catalog WHERE book='$field'");
$view=mysql_fetch_array($get);
$i++;
echo "
<form id='Entry_view' action='Entry_view.php' method='get' target='area_right' >
<input type='hidden' id='input$i' name='Entry_view_get' value='$field' />
<a href='' onClick='submit();standout();' >
<div id='div' style=background:url('Background/Transparent_8.png')no-repeat;background-size:350px;width:450px;height:30px;float:left;margin-left:5px;margin-top:5px;border-radius:3px;>
<div style='font-family:calibri;padding-left:5px;padding-top:3px;float:left;size:8px;color:darkgreen;font-weight:bold;margin-top:0px;margin-left:0;border:groove;border-radius:3px;width:340px;height:21px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;'>
$field
</div>
</a>
<div style='font-family:calibri; font-size:10px; color:darkgreen; height:25px; font-weight:bold;float:left;margin:2px 0px 0px 2px;' >
Total Books: ".$view[b_total]." <br />Books on Shelf: ".$view[b_os]."
</div>
</div>
</form>
";
}
echo "</div>";
不要介意我的 div 和表单,这只是我为功能提供的额外细节。