到目前为止,我的代码似乎与一行有所不同,我得到以下错误:
警告:mysql_fetch_assoc()期望参数1为资源,第37行的C:\ xampp \ htdocs \ Website \ Search.php中给出布尔值
第37行如下:
while($name=mysql_fetch_assoc($records))
其余代码:
HEAD> <TITLE> Search </TITLE> </HEAD>
<BODY>
<h1>Search for your favourite movies here</h1>
<b>`enter code here`
<p> Here you can search through our exciting selection of existing and upcoming movies </p>
<p> You can search our website by choosing from one of the drop down lists below depending on what you
know about the movie </p>
</b>
<?php
mysql_connect('localhost', 'root', '');
mysql_select_db('database');
$sql="SELECT * FROM names";
$records=mysql_query($sql);
mysql_connect();
?>
<html>
<body>
<table width="600" border="1" cellpadding="1" cellspacing="1">
</table>
<tr>
<th>fname</th>
<th>sname</th>
<th>age</th>
<tr>
<?php
while($name=mysql_fetch_assoc($records))
{
echo "<tr>";
echo "<td>.$name.['fname'].</td>";
echo "<td>.$name.['sname'].</td>";
echo "<td>.$name.['age'].</td>";
echo "</tr>";
}
?>
</BODY>
</HTML>
我正在尝试从数据库中复制信息并将其显示在我的网页上。任何帮助将不胜感激。
答案 0 :(得分:0)
你正在做=iif(Fields!ACT.Value = "N/V", "No Color",
iif(Fields!ACT.Value = "N/K", "No Color",
iif(Fields!ACT.Value = "N/A", "No Color",
iif(Fields!NUM.Value < Fields!SHORT.Value , "Yellow",
iif(Fields!NUM.Value > Fields!INC.Value, "Orange",
iif((isnothing(Fields!ACT.Value <> "N/A" and Fields!NUM.Value) or isnothing(Fields!ACT.Value <> "N/K" and Fields!NUM.value) or isnothing(Fields!ACT.Value <> "N/V" and Fields!NUM.Value)), "Purple", "No Color"))))))
两次 - 第二次没有参数。
因此,当您执行mysql_connect()
时,您没有有效的资源。