I have a table filled out with data from the mysql DB, I have a DELETE button next to each row to allow user to delete the specific row of the table. but my code only removes the first lines of the table on each click I have tried many other suggested ways in this forum but no one works for me. here is the code please help.
I know this code just delete the first lines on each click, please tell me which syntax and commands should i use, will be appreciated if you help me to get it right.
the HTML table
$query = "SELECT * FROM $table_select";
$result = mysql_query($query);
$num = mysql_num_rows($result);
$i=0;
while ($i < $num) {
$f1=mysql_result($result,$i,"manager_st");
$f2=mysql_result($result,$i,"freelancer_st");
$f3=mysql_result($result,$i,"link");
$f4=mysql_result($result,$i,"photo");
$f5=mysql_result($result,$i,"unit_price");
$f6=mysql_result($result,$i,"qty");
$f7=mysql_result($result,$i,"express");
$f8=mysql_result($result,$i,"customer_st");
$f9=mysql_result($result,$i,"additional_link");
$totao_unit_price = $f5*$f6;
$row = mysql_result($result,$i,"product_id");
?>
<tr>
<td> <button type="button" onclick="displayResult()">Delete</button></td>
<td><p><font face="Arial"><input name="row_txtbox" type="text" id="row_txtbox" size="2" value="<?php echo $row; ?>"></font></td>
<td><p><font face="Arial"> <textarea name="manager_txtbox" cols="10" id="manager_txtbox"><?php echo $f1; ?></textarea></font></td>
<td><p><font face="Arial"> <textarea name="purchase_txtbox" cols="10" id="purchase_txtbox"><?php echo $f2; ?></textarea>
</font></td>
<td>
<font face="Arial"><input name="main_link" type="text" id="main_link" size="2" value="<?php echo $f3; ?>"></font></td>
<td><font face="Arial"><img src="<?php echo $f4;?>" width="100" align="middle"100></font></td>
<td><font face="Arial"><input name="unitprice_txtbox" type="text" id="unitprice_txtbox" size="2" value="<?php echo $f5; ?>"></font></td>
<td><font face="Arial"> <input name="qty_txtbox" type="text" id="qty_txtbox" size="2" value="<?php echo $f6; ?>"></font></td>
<td><p><font face="Arial"><?php echo $totao_unit_price; ?></font></td>
<td><p><font face="Arial"><input name="express2" type="text" id="express3" size="2" value="<?php echo $f7; ?>"></font></td>
<td><p><font face="Arial"> <textarea name="custdesc_txtbox" cols="20" id="custdesc_txtbox"><?php echo $f8; ?></textarea></font></td>
<td><font face="Arial"><p><font face="Arial"><input name="additional_link" type="text" id="additional_link" size="2" value="<?php echo $f9; ?>"></font>
<p>
<?php
$i++;
}
?>
</table>
</p>
<p>
</p>
</div>
</form>
The Jquery
<script type="text/javascript">
function displayResult()
{
document.getElementById("neworder_listview").deleteRow()
}
</script>

New Topic/Question
Reply


MultiQuote





|