所以我准备好的声明有效,但我不知道如何告诉 php 加入两列。
我尝试了一个没有准备的声明并且有效。我尝试向 bind_results 添加更多变量。
$stmt = mysqli_prepare($con, "Select tblcategory.CategoryName as catname,tblcategory.id as catid, tblwritter.Writter as writtername, tblwritter.writterdescription as writterdescription, tblwritter.PostingDate as writterpostingdate, tblwritter.UpdationDate as writterupdationdate, tblwritter.WritterId as writterid from tblwritter join tblcategory on tblwritter.CategoryId=tblcategory.id where tblwritter.Is_Active=1 and WritterId=?");
$stmt->bind_param("i", $writterid);
$writterid=intval($_GET['scid']);
$stmt->execute();
$stmt->bind_result($catname,$catid,$writtername,$writterdescription,$writterpostingdate,$writterupdationdate,$writterid);
$stmt->fetch();
<div class="form-group">
<label class="col-md-2 control-label">Category</label>
<div class="col-md-10">
<select class="form-control" name="category" required>
<option value="<?php echo $catid;?>"><?php echo $catname;?></option>
<?php
$stmt = $con -> prepare('select id,CategoryName from tblcategory where Is_Active=?');
$stmt -> bind_param('i', $Is_Active);
$Is_Active = 1;
$stmt -> execute();
$stmt -> store_result();
$stmt -> bind_result($id, $CategoryName);
$stmt -> fetch();
// Feching active categories
$ret=mysqli_query($con,"select id,CategoryName from tblcategory where Is_Active=1");
while($result=mysqli_fetch_array($ret))
{
?>
<option value="<?php echo htmlentities($result['id']);?>"><?php echo htmlentities($result['CategoryName']);?></option>
<?php } ?>
</select>
</div>
</div>
预期的结果是类别应该下拉以编辑类别。
手掌心