RE: Append a Query

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

 



> I am trying to make a query based on the user input, for a search
page.
> So, I have the initial query set up like:
> $query = "select PUB_ID, AUTHOR, TITLE, YEAR  from * where
> USER.USER_ID=$user and USER.USER_ID=USER_PUB.USER_ID";
> 
> if ($author != null){
>             //append this string to the $query already stated
>             " and JOURNAL_ARTICLE.AUTHOR=$author";
> }
> if ($title != null){
>             //append this string also
>             " and JOURNAL_ARTICLE.TITLE=$title";
> }
> 
> How do you do this concatenation?

Use the period character to concatenate strings...

$query = $query . 'add this string to query';

or

$query .= 'add this string to query';

A simple look through the manual would have answered this for you...

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux