RE: [PHP-DB] Question: Putting separate form elements into an array

From: Date: Sun, 17 Oct 2004 15:13:47 +0000
Subject: RE: [PHP-DB] Question: Putting separate form elements into an array
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-36873@lists.php.net to get a copy of this message
Changed my direction somewhat but keep getting a parse error and although I know where it is , I can't seem to figure out what I need to do to make it syntax correct: This is how I am passing the arrays: if ( empty( $_SESSION['l_skill'] ) ) { $_SESSION['l_skill']=array(); } if ( is_array( $_REQUEST['skill'] ) ) { $_SESSION['l_skill'] = array_unique( array_merge( $_SESSION['l_skill'], $_REQUEST['skill'] ) ); } if ( empty( $_SESSION['l_sky'] ) ) { $_SESSION['l_sky']=array(); } if ( is_array( $_REQUEST['sky'] ) ) { $_SESSION['l_sky'] = array_unique( array_merge( $_SESSION['l_sky'], $_REQUEST['sky'] ) ); } if ( empty( $_SESSION['l_slu'] ) ) { $_SESSION['l_slu']=array(); } if ( is_array( $_REQUEST['slu'] ) ) { $_SESSION['l_slu'] = array_unique( array_merge( $_SESSION['l_slu'], $_REQUEST['slu'] ) ); } This is how I am trying to get them into the database: $queries = array(); for($i=0; $i<count($l_skill); $i++) { $queries[] = "('" . $l_skill[$i] . "', " . $l_sky[$i] . ", " . $l_slu[$i] . ")"; } if(count($queries) == 0) { # Nothing passed # exit } $query = "INSERT INTO LurkProfiles_Skicerts (ProfileID, SkilCerts, NumYear, Lused) VALUES ($LUID ". implode(", ", $queries); //Above line is where I am having the problem. There is something between LUID and the implode statement. LUID is not passing into the insert generating a sql error. $result = mysql_query($query); echo $query; --- Stuart Felenstein <stuart4m@yahoo.com> wrote: >

« previous php.db (#36873) next »