Re: [PHP-DB] How to..? From: David Newcomb (davidn <email protected>)
Date: 07/13/00

Voktech,

Try this as an example, if you have hundreds of variables then you
may find it easier to handle them if they are stored in an associated array.
For example: (Tested and works):

<html><body>
<?

function add_quotes(&$item, $key, $prefix)
{
        $item = ereg_replace("(.*)","\"\\1",$item);
}

$tmp[customer] = "bill";
$tmp[text] = "hello";
$tmp[note] = "d-minor";

array_walk($tmp,'add_quotes');

echo "$tmp[customer]<br>\n";
echo "$tmp[text]<br>\n";
echo "$tmp[note]<br>\n";

?>
</body></html>

Does this help?

David.
----- Original Message -----
From: Vojtech Dvorak <vojtech_dvorak <email protected>>
To: David Newcomb <davidn <email protected>>
Sent: Thursday, July 13, 2000 2:18 PM
Subject: Re: [PHP-DB] How to..?

> Yes this works fine too,
> but I have hundreds of these variables ($customer, $text, $report, $note
> etc.) Don't you know how can I quote them all at once?
> Vojtech
>
> >
> > _Will_ do it ;)
> >
> > $customer="\"$customer\"";
> > $text="\"$text\"";
> >
> > David.
> >
> > ----- Original Message -----
> > From: Vojtech Dvorak <vojtech_dvorak <email protected>>
> > To: <php-db <email protected>>
> > Sent: Thursday, July 13, 2000 1:57 PM
> > Subject: [PHP-DB] How to..?
> >
> >
> > > Hi,
> > > I need to add quotes to array of strings.
> > > How can I do that?
> > >
> > > Now, I do every time :
> > >
> > > $customer=' " '.$customer.' " ' ;
> > > $text=' " '.$text.' " ' ;
> > > ... etc.
> > >
> > > Thanks
> > > Vojtech
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>