我需要在行的rating_estimate列中选择值,其中title等于$ storeArray中的元素。我试图使用IMPLODE,但它不起作用。我也不确定mysql_fetch_array。包括问题在内的整个代码是:
<html>
<?php
$storeArray=array("Annie"," Unbroken","Top Five");
$result= Array();
$inputuser="oje";
$user="root";
$password="";
$database="movierating";
$connect=mysql_connect("localhost",$user, $password);
@mysql_select_db($database) or ("database not found");
$sql = mysql_query("SELECT rating_estimate FROM $inputuser WHERE title In ('" . implode('"', $storeArray) . "')");
while($row = mysql_fetch_array($sql, MYSQL_ASSOC))
{
$result[] = $row['rating_estimate'];
}
foreach ($result as $value)
{
echo $value;
echo "<br>";
}
?>
</html>
因为声誉,我无法放置图片,屏幕在这里http://imagelink.cz/images/beznzvuepe.png
它没有显示浏览器中的任何错误,页面为空白