Note that there are some explanatory texts on larger screens.

plurals
  1. POmultiply value from database to my textbox
    primarykey
    data
    text
    <p>i have 1 table named sales and the ff fields in it are</p> <pre> id | total_fields | 1 | 100 | </pre> <p>now myproblem is that how to multiply the values in textbox into the value of table which is "total_fields".what i want is that when i input value from my textbox in line 60 and click updatesale.php on line 66 the total value of my "total_fields" must be multiplied to what value i input into my textbox. so if i input 2 "total_fields" must be 200and if i input 3 "total_fields" must be 300. i tried anything what i've learn but i can't get exactly what i am looking for. any idea is very helpful for me.</p> <pre><code> &lt;?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("inventory", $con); $f=$_SESSION['SESS_MEMBER_ID']; $result = mysql_query("SELECT * FROM sales where code = '".$f."' GROUP BY pcode"); function formatMoney($number, $fractional=false) { if ($fractional) { $number = sprintf('%.2f', $number); } while (true) { $replaced = preg_replace('/(-?\d+)(\d\d\d)/', '$1,$2', $number); if ($replaced != $number) { $number = $replaced; } else { break; } } return $number; } while($row = mysql_fetch_array($result)) { $pcode = $row['pcode']; $totalretail = 0; $qty_tot = 0; $rr_tot = 0; $vats_tot = 0; $final_tot = 0; $item_amount = 0; $result_info = mysql_query("SELECT * FROM sales where pcode = '".$pcode."'"); while($row_info = mysql_fetch_array($result_info)){ $name = $row_info['name']; $qty = $row_info['qty']; $ppp=$row_info['PRICE']; $rr=$row_info['total']; $id = $row_info["id"]; $vats = $row_info["vats"]; $percent = $row_info["percent"]; $qty_tot += $qty; $rr_tot += $ppp; $item_amount += $ppp; $totalretail += $rr; $vats_tot += $vats; } echo '&lt;tr&gt;'; echo '&lt;td style = "background-image:url(images/buts1.png);border:0px;"&gt;&lt;div align="center" style = "color:black"&gt;'.$pcode.'&lt;/div&gt;&lt;/td&gt;'; echo '&lt;td style = "background-image:url(images/buts1.png);border:0px;&gt;&lt;div align="center" &gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;'.$name.'&lt;/div&gt;&lt;/td&gt;'; echo '&lt;td style = "background-image:url(images/buts1.png);border:0px;&gt;&lt;div align="center"&gt;'.$qty_tot.'&lt;/div&gt;&lt;/td&gt;'; echo '&lt;/div&gt;&lt;/td&gt;'; echo '&lt;td&gt;'.$vats_tot.'&lt;/td&gt;'; echo '&lt;input type = "text" name = "multiply" style = "width:30px;"/&gt;'; echo '&lt;/div&gt;&lt;/td&gt;'; echo '&lt;td style = "border:0px;background-image:url(images/buts1.png)"&gt;'; echo formatMoney ($totalretail , true); echo '&lt;/div&gt;&lt;/td&gt;'; echo '&lt;td style = "background-image:url(images/buts1.png);border:0px;"&gt;'; echo '&lt;a href=updatesales.php?id=' . $row["id"] .'&gt;update |&lt;/a&gt;'; echo '&lt;a href=delete.php?id=' . $row["id"] .'&gt;Cancel&lt;/a&gt;'; echo '&lt;/td&gt;'; echo '&lt;/tr&gt;'; } mysql_close($con); ?&gt; </code></pre>
    singulars
    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.
 

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