Hi All,
I am having trouble with a nested loop and I can't seem to get it figured out. I keep getting an error that states, Invalid argument on line 20. Here is the code; Sessions capture question answers that are multiple answers for each question. $answers = array($_SESSION['question1'],$_SESSION['question2'],$_SESSION['question3'],$ _SESSION['question4'], $_SESSION['question6'],$_SESSION['question7'],$_SESSION['question8'],$_SESSI ON['question9'], $_SESSION['question10'],$_SESSION['question11']); I init the vars $question = ""; $subquestion = ""; Here's the loop I'm having trouble with. foreach ($answers as $questions) { $question .= "__"; foreach ($questions as $subquestion) { -- Here's the offending line -- $question .= $subquestion."--"; } } I am inserting an array of arrays..., I know it's not the best way to do this but I was only given a few hours to get this up. The array is delimited by a double underscore and individual answers are delimited by a double hyphen. Or at lease that's what's supposed to happen. $insert_query = "INSERT INTO SurveyTable (sur_ques_id, sur_ans, sur_num) VALUES (1, '$questions', 1)"; $result = MSSQL_QUERY($insert_query) or die("Can not execute query $insert_query. "); The value in the db is either "Array" or part of the string but not the whole string. I know the error is creating most of the problem. I can't see what I'm doing wrong.... Why is that argument invalid? alex hogan ****************************************************************** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. ******************************************************************