> -----Original Message-----
> From: Matthew Moldvan [mailto:[EMAIL PROTECTED]
> Sent: 10 June 2003 16:50
> 
> As for the line breaks, I've used SQL formatted that way before and it
> hasn't cause me any problems.

It's a matter of preference, but I prefer to keep my query strings as lean as possible 
-- bear in mind that this version:

> > >           $sql = "UPDATE newdacs
> > >                   SET emailfwd='$emailfwd',
> > >                   mformat='$mformat',
> > >                   filter_code='$filter_code'";

will include not only the linebreaks but also all the leading whitespace on every line.

Personally, I like the technique of breaking my query up logically onto multiple 
lines, but I also prefer not to include unnecessary whitespace in the constructed 
query.  In addition, it seems to me that the repetitive inclusion of "$sql .= " on 
every line is not only distracting but also slightly inefficient, as you perform a 
concatenation and assignment for every line -- by using the form I showed in my 
previous response, you can reduce this to just a concatenation per line, and a single 
assignment:

        $sql = "UPDATE newdacs"
              . "SET emailfwd='$emailfwd',"
              . "mformat='$mformat',"
              . "filter_code='$filter_code'";

Of course, this is all completely IMHO, and I wouldn't say that any of the other ways 
of doing it is absolutely wrong.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to