Problem with a dinamic variable --> array

From: Date: Wed, 23 Jul 2003 23:03:41 +0000
Subject: Problem with a dinamic variable --> array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-156473@lists.php.net to get a copy of this message
Here its the scenario: i have a table with campo1x, campo1y, campo2x, campo3y, ..... campo10x, campo10y on the table ejes so what i need to do is to split an array that i send to this page on php .. and include the values on this fields (but only on the fields that the $num its writen) (this is make by this way because the data is from flash) <?php $propiedades= array("x","y"); // this values came from a $_POST (not now but they will) $ejey ="1,2,3,4"; $ejex = "1,3,22,4"; $num= "1,2,5,7"; $valx = split(",", $ejex); $valy = split(",", $ejey); $numo= split(",", $num); for ($i = 0; $i < count($numo) ; $i++) { for ($e = 0; $e < 2 ; $e++) { // here its campo1x so then on the update i know wich field i have to update... // the problem is that i dont know how can i retrive the value of $valx and $valy // this is OK .. because i know the name of the field that i have to update... my problem is to catch the value ! $a="campo" .$numo[$i] . $propiedades[$e]; /* this is WRONG ! i need $valy[0] or $valx[0] values checking with $propiedades[$e] $b="\$val" . $propiedades[$e]. [$e]; */ // wrong the $b $result2 = mysql_query("UPDATE ejes SET $a='$b'", $Connect); } } ?> Hope some good programmer can help me.. Wan Chan

« previous php.general (#156473) next »