<?php
session_start();
include 'functions/db.php';
$strid=$_SESSION['stream'];
$catid=$_SESSION['category'];
echo $strid;
if(isset($_POST['submit']))
{
$sql= mysqli_query($con,"SELECT * from questions where strid='$strid'");
$num = mysqli_num_rows($sql);
if($num>0)
{
while($row=mysqli_fetch_assoc($sql)){
extract($row);
if(isset($_POST[$row['quesid']]))
{
$k=$_POST[$row['quesid']];
$v=$row['crsid'];
echo $k;
echo $v;
if($k==1)
{
$sql="UPDATE tblupdate SET very_interested=very_interested+1 WHERE crsid=$v";
$res=mysqli_query($con,$sql);
/* if($res==true)
{
echo '<script language="javascript">';
echo 'alert("Post Successfully")';
echo '</script>';
}*/
}
}
}
}
}
?>
while循環不重複第二次。和錯誤警告:mysqli_fetch_assoc()預計參數1被mysqli_result,在C指定的字符串:\ XAMPP \ htdocs中\ p \ forum1 \ next1.php上線13出現警告:mysqli_fetch_assoc()預計參數1被mysqli_result,在C給定的字符串: XAMPP htdocs中 p forum1 next1.php上線13
它很常見的問題....在詢問至少搜索之前...您會得到很多類似的問題和答案... – Naincy
可能的[Warning:mysqli \ _fetch \ _assoc()的副本需要參數1爲mysqli \ _result,字符串給定](http://stackoverflow.com/questions/36400846/warning-mysqli-fetch-assoc-expects-parameter- 1-to-mysqli-result-string-gi) –
$ sql = mysqli_query($ con,「SELECT * from strid ='」。$ strid。「'」);使用正確的解析 –