-1
showcattable是顯示一個表,現在我打電話dispcategoriesstate它將顯示類別的狀態...在輸出我得到類別狀態,但之後,進一步的代碼執行停止..也沒有錯誤。
函數來顯示錶Php函數不能正常工作
function showcattable($con){
$i=2;
$select = mysqli_query($con, "SELECT * FROM categories");
while ($row = mysqli_fetch_assoc($select))
{
echo"<tr>
<td class='v-align-middle'><div class='checkbox check-default'>
<input type='checkbox' name='chk[]' value='".$row['cat_id']."' id='checkbox".$i."'>
<label for='checkbox".$i."'></label>
</div></td>
<td class='v-align-middle'>".$row['category_title']." </td>
<td class='v-align-middle'>".$this->dispcategoriesstate($row['cat_id'],$con);"</td>
<td>
<a href='edit_product.php?pro_id=18'>
<i class='fa fa-pencil-square-o'/>
</i></a> |
<a href='product.php?del_id=18&action=del' onclick=' return confirm('Are you sure you want to delete this?');'>
<i class='fa fa-close'/>
</i>
</a>
</td>
</tr>";
$i++;
}}
函數來顯示狀態
function dispcategoriesstate($parent_id,$con) {
$q="SELECT status FROM categories WHERE cat_id='".$parent_id."'";
$select=mysqli_query($con,$q);
$row=mysqli_fetch_array($select);
if ($row['status']==1)
{
return 'active';
}
else
{
return 'inactive';
}
}
感謝這是一個愚蠢的錯誤...再次感謝 –
@Nirajdev好,如果我的回答是正確的,請將它標記爲已接受...看看這裏如何https://meta.stackexchange.com/questions/5234/how-does -accepting-的回答工作 –