RE: [PHP] Logic problem

2004-04-20 Thread Alex Hogan
> What's in your array? $array1[0] = 'firstname'; $array1[1] = 'lastname'; $array1[2] = 'tkt_title'; I got that fixed. Thanks. alex hogan ** The contents of this e-mail and any files transmitted with it are confidential and i

Re: [PHP] Logic problem

2004-04-20 Thread John Nichel
Alex Hogan wrote: I gotcha.., I do have one question though. I ran your code and it only returns the first letter for that element in the array. For instance fieldone returns as f and tableone returns as t. The output looks like this; SELECT f,f,f FROM t,t. alex What's in your array? -- ***

RE: [PHP] Logic problem

2004-04-20 Thread Ford, Mike [LSS]
On 20 April 2004 16:44, Alex Hogan wrote: > foreach ( $array1 as $flds ) { > if ( $start ) { > $query .= $flds; > $start = false; > } else { > $query .= ", " . $flds; > > } > } $query .= implode(", ", $array1); Cheers! Mike --

Re: [PHP] Logic problem

2004-04-20 Thread Kelly Hallman
Apr 20 at 9:55am, Alex Hogan wrote: > function myselect($array1, $array2){ > $query = "SELECT".foreach($array1 as $flds){ $flds[$i]; }. > "FROM".foreach($array2 as $tbls){ $tbls[$n]; } ... Alex, if you merely wish to place the values of an array into your query, you might also try doing it th

RE: [PHP] Logic problem

2004-04-20 Thread Alex Hogan
[snip] I do have one question though. I ran your code and it only returns the first letter for that element in the array. For instance fieldone returns as f and tableone returns as t. The output looks like this; SELECT f,f,f FROM t,t. [/snip] Never mind I found it. It should be; $query = "SELEC

RE: [PHP] Logic problem

2004-04-20 Thread Alex Hogan
[snip] > $query = "SELECT "; > $start = true; > foreach ( $array1 as $flds ) { > if ( $start ) { > $query .= $flds[$i]; > $start = false; > } else { > $query .= ", " . $flds[$i]; > } > } > $query .= " FROM "; > $start = true; > foreach ( $

Re: [PHP] Logic problem

2004-04-20 Thread John Nichel
Alex Hogan wrote: 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