Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query help joining two statements

Status
Not open for further replies.

paublo

ISP
Sep 14, 2006
127
US
Hi, i have the following in a php script that is currently working, HOWEVER...

Code:
'default' => array('query_set' => 'REPLACE INTO vacation (email, subject, body, domain, created, active) VALUES (\U, \S, \M, \D, NOW(), 1)',
                                   'query_unset' => 'UPDATE vacation SET active=0 WHERE email=\U',
                                   'query_get' => 'SELECT subject, body, active AS vacation FROM vacation WHERE email=\U',
                                   'hordeauth' => 'full')));


I would like to add an extra statement to the query_set to update another table called aliases.

I would like the query_unset to remove what was added to the aliases table when called as well.

I tried the following for query_set and it did not work

Code:
'query_set' => 'REPLACE INTO vacation (email, subject, body, domain, created, active) VALUES (\U, \S, \M, \D, NOW(), 1) and REPLACE INTO alias (address, goto, domain, created, active) VALUES (\U, some_alias, \D, NOW(), 1) WHERE address=\U',

so I'm having problems with everything after the and on the query_set. I'm not sure how to join more than one query.

thanks very much in advance, Paul



 
This is a PHP question related to adding another entry in an array. Not directly to the actual MYSQL query, which by the way you ca;t just add more statements with an AND to the query.

Without seeing more code, I can only guess something further down in your PHP code loops through that array, and executes the queries one by one.

As a guess I would venture something like:

Code:
'default' => array('query_set' => 'REPLACE INTO vacation (email, subject, body, domain, created, active) VALUES (\U, \S, \M, \D, NOW(), 1)',
[red]'query_set2'=>'REPLACE INTO alias (address, goto, domain, created, active) VALUES (\U, some_alias, \D, NOW(), 1) WHERE address=\U'[/red]
,
                                   'query_unset' => 'UPDATE vacation SET active=0 WHERE email=\U',
                                   'query_get' => 'SELECT subject, body, active AS vacation FROM vacation WHERE email=\U',
                                   'hordeauth' => 'full')));

For a more specific answer, you could post this in the forum434.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top