[PHP] Hello again. new newbie querstion
I have done as you explain for me an it works very vell in the halft part of my application. But below is my snippet of my source code where the number of items and weight not will update itself. This code do as what number I write in the "oppdater_stk_nonel_tenner[]" field is written as result, instead of the calculated result. I am also using var_dump() to check my viariables but there is something here I have missed. I hope it is ok to post my norwegian search code as an exaple. If this source code is to difficult because of my long norwegian name (Description of the meaning of varable) i will re-write it all in English as I appricate your good advice and help! Tanks. // My form with array's " "> "> "> if(isset($_POST['oppdater_nonel_tennere'])){ $valgt_lager = $_POST['valgt_lager']; $varenr = $_POST['varenr']; $kg_pa_lager = $_POST['kg_pa_lager']; $stk_pa_lager = $_POST['stk_pa_lager']; $oppdater_stk_nonel_tenner = $_POST['oppdater_stk_nonel_tenner']; include('../../tilkobling.php'); // count how many serialnumber it is the the array for use later in for loop. $antall_varenr = count($varenr); // Run for loop as long as $i is less than or equal to $antall_varenr. for($i=0;$i<$antall_varenr;$i++){ // update amont in stock. Adding value of $oppdater_stk_nonel_tenner[$i] to $stk_pa_lager $stk_pa_lager[$i] += $oppdater_stk_nonel_tenner[$i]; // Get new weight in kg in stock $kg_pa_lager = $stk_pa_lager[$i] * 0.001; // Update the database table $sql = "UPDATE nonel_tennere SET stk_pa_lager = '$stk_pa_lager[$i]', kg_pa_lager = '$kg_pa_lager' WHERE varenr = '$varenr[$i]' LIMIT 1"; mysql_query($sql,$tilkobling) or die(mysql_error()); var_dump($sql); } echo "Databasen er oppdatert"; ?> "> I can't figure out why $stk_pa_lager[$i]; is the same as written in $oppdater_stk_nonel_tennere[$i] as long I have us this += operator in $stk_pa_lager[$i] += $oppdater_stk_nonel_tenner[$i]; I have just copy and past it from a working example above and chance the table name and $oppdater_stk_nonel_tenner[$i] variable. Thanks for your time. Karl
Re: [PHP] Hello again
On Sun, Jul 1, 2012 at 6:21 PM, RGraph.net support wrote: > Just thought I'd say hello again. Back to brush up on my PHP a little > after a bit of a break - more reading than replying I'd imagine. I > have some pretty bad jokes too that I might surreptitiously insert > here and there... Welcome back. Friday is mainly the free-for-all day (philosophical questions, puns, jokes) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Hello again
Hi, Just thought I'd say hello again. Back to brush up on my PHP a little after a bit of a break - more reading than replying I'd imagine. I have some pretty bad jokes too that I might surreptitiously insert here and there... Cheers. -- Richard Heyes, RGraph.net support RGraph: JavaScript charts for your website http://www.rgraph.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php