Append a Query
| From: | Alexa Kirk | Date: | Sat, 19 Apr 2003 15:19:40 +0000 |
| Subject: | Append a Query | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-27182@lists.php.net to get a copy of this message | ||
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?
Thanks,
Alexa