Note that there are some explanatory texts on larger screens.

plurals
  1. POtwo while loop using prepared statement but my inner while loop is not working
    primarykey
    data
    text
    <p>prepared statement : i am using two while loop, but my inner while loop is not working. when i use inner while loop its showing me only one record but when i remove inner while loop i can see all the records..how can i solve it?</p> <p>here is my code</p> <pre><code>&lt;table width="100%" style="background-color:#F2F2F2;border:1px solid #F2F2F2;border-radius:15px;"&gt; &lt;form name="form1" id="form1" method="post" action=""&gt; &lt;tr&gt; &lt;td align=""&gt; &lt;table width="100%" style="background-color:#F2F2F2;border:1px solid #F2F2F2;border-radius:15px;"&gt; &lt;tr class="table-heading"&gt; &lt;td &gt;&amp;nbsp;Qty.&lt;/td&gt; &lt;td &gt;&amp;nbsp;Writer&lt;/td&gt; &lt;td &gt;&amp;nbsp;Status&lt;/td&gt; &lt;td &gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt;&lt;?php if($stmt-&gt;prepare("select id,qty,action_flag,status,writer from tbl_order where status=? and action_flag=? and order_id=?")) { $action='confirm'; $status='orderprocessing'; $ordid=$_GET["ordid"]; $stmt-&gt;bind_param('sss',$status,$action,$ordid); $stmt-&gt;execute(); $stmt-&gt;store_result(); $stmt-&gt;bind_result($id,$qty,$action_flag,$status,$writer); } while($stmt-&gt;fetch()) // outer while loop { ?&gt; &lt;tr align="left" style="line-height:30px;font-size:12px;"&gt; &lt;td &gt;&amp;nbsp;&lt;?php echo $qty; ?&gt;&lt;/td&gt; &lt;td align="center" width="160" &gt; &lt;select name="selwrt" id="selwrt" class="reginput" style="text-transform:capitalize;width:150px;height:25px;" &gt; &lt;option value=""&gt;Select Writer&lt;/option&gt; &lt;?php if($stmt-&gt;prepare("select id,writer_name from tbl_writer order by writer_name")) { $stmt-&gt;execute(); $stmt-&gt;store_result(); $stmt-&gt;bind_result($wid,$writer_name); } while($stmt-&gt;fetch()) // inner while loop { ?&gt; &lt;option value="&lt;?php echo $wid; ?&gt;"&lt;?php if($writer==$wid) echo 'selected="selected"'; ?&gt;&gt;&lt;?php echo $writer_name; ?&gt;&lt;/option&gt;&lt;?php } ?&gt; &lt;/select&gt; &lt;/td&gt; &lt;td align="center" width="160" &gt;&lt;select name="selst" id="selst" class="reginput" style="text-transform:capitalize;width:150px;height:25px;"&gt; &lt;option value=""&gt;Select Status&lt;/option&gt; &lt;option value="inprogress"&lt;?php if($status=='inprogress') echo 'selected="selected"'; ?&gt;&gt;In Progress&lt;/option&gt; &lt;option value="jobdone"&lt;?php if($status=='jobdone') echo 'selected="selected"'; ?&gt;&gt;Job Done&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;td style="vertical-align:top;" &gt;&lt;input type="submit" name="btnsave" id="btnsave" value="SAVE" class="btnstyle" style="padding:3px;"/&gt; &lt;input type="hidden" name="pid" id="pid" value="&lt;?php echo $id; ?&gt;" &gt;&lt;/td&gt; &lt;/tr&gt;&lt;?php } ?&gt; &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload