RE: PHP/MySQL noob rides again.. into trouble

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



periods are used to do string concatenation. So if you want to break a
statement up you can do:

$string = "First part." . " And this is the second part";

I often do it when inserting variables:

$sql = "select * from The_Other_Guy";
if(case 1) {
	$sql .= " where The_Other_Guy.Is = ".$something;
} else {
	$sql .= ", Women W where The_Other_Guy.WifeId = W.Id and W.Age <
". $age;
}

$sql .= "order by The_Other_Guy.Pay_Grade";

or something like that.

> -----Original Message-----
> From: Paul Jinks [mailto:paul@xxxxxxxxxxxxxxx] 
> Sent: Friday, December 16, 2005 8:21 AM
> Cc: php-general@xxxxxxxxxxxxx
> Subject: Re:  PHP/MySQL noob rides again.. into trouble
> 
> David Grant wrote:
> 
> > $SQLQuery = "SELECT * FROM project WHERE projTitle = '" .
> > $HTTP_GET_VARS['projTitle'] . "'";
> 
> Yep, that fixed it. Thanks. I had a feeling there was a mix 
> up with the "s and 's. What's with the .  s?
> 
> > Not sure why you've got the or die() there.
> 
> I had the idea that you could put an or die() after any 
> command and it would tell you that it had screwed up at that 
> point. Bad idea?
> 
> Many thanks
> 
> Paul
> 
> --
> PHP General Mailing List (http://www.php.net/) To 
> unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux