Hi All, I am having a logic problem. (insert jokes here) I am trying to create a function that will allow me to pass any number of fields and tables into a blanket query.
I am getting an error; Unexpected foreach. I have tried placing the loop in several different places and am getting the same error. What should I be doing differently? Here's my code; function myselect($array1, $array2){ $i = 0; $n = 0; $query = "SELECT".foreach($array1 as $flds){ $flds[$i]; }. "FROM".foreach($array2 as $tbls){ $tbls[$n]; }.; $result = mssql_query($query); print "<table width=\"100%\" border=\"1\"> <tr>"; $j = 0; while($row = mssql_fetch_array($result)){ $fields = $row[flds[$j]]; print "<td>".$fields."</td></tr>"; } } alex ****************************************************************** 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. ******************************************************************