This topic is locked

Is this possible

6/18/2010 10:47:04 AM
PHPRunner General questions
S
swanside author

Hello.

I want a button on the list page that will perform this action
UPDATE job

INNER JOIN sites ON job.Order_Site_Address=sites.site_address

SET job.LocationId = sites.LocationId

WHERE Order_Site_Address = sites.site_address
I have about 8000 entries to alter, and alot of them are repeated, so once I do one which is repeated a few time, I can press this button and it will send the action to the server?

Cheers

Paul.

Sergey Kornilov admin 6/18/2010

Sure, insert button in Visual Editor and write server side code that executes this query.

CustomQuery("your SQL query here");
S
swanside author 6/19/2010

Hi.

Thanks for that, but it wont work.

In visual Editor, I click on Insert Button, CLick the Server Tab and paste this code into it
UPDATE job

INNER JOIN sites ON job.Order_Site_Address=sites.site_address

SET job.LocationId = sites.LocationId

WHERE Order_Site_Address = sites.site_address
I click on Check Syntax and get

syntax error, unexpected T_STRING in line 1
Any ideas as to why please?

Thanks

Paul.

A
ann 6/22/2010

Paul,
your query will be executed only using CustomQuery() function.

Herу is a sample:

$sql = "update job INNER JOIN sites ON job.Order_Site_Address=sites.site_address

SET job.LocationId = sites.LocationId WHERE Order_Site_Address = sites.site_addressset active=0 where id=32";

CustomQuery($sql);