John's solution is the better one. But if you really wish to stick to
your own, try and use eval() to complile $where$i.
Edwin
John W. Holmes wrote:
I have:
if ($where1 != '')
{
$whereArray = array_push($whereArray, $where1);
}
and I want to repeat for $where1 up to $where8
but ra
> I have:
>
> if ($where1 != '')
> {
> $whereArray = array_push($whereArray, $where1);
> }
>
> and I want to repeat for $where1 up to $where8
>
> but rather than write it out 8 times, I'd rather use a loop
>
> for ($i=1; $i<=8 i++)
> {
> if ($where1 != '')
> {
> $whe
You could probably do this. Set up a $$where variable, which would contain
"where" . $i, $i being the iterator of your loop.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
for ($i=1; $i<=8 i++)
{
if (${'where'.$i} != '')
{
$whereArray = array_push($whereArray, ${'where'.$i});
}
}
julian haffegee wrote:
Hi all,
I have something thats been driving me mad for days
I have:
if ($where1 != '')
{
$whereArray = array_push($whereArray, $where1);
4 matches
Mail list logo