Page 2 of 2

Re: show and edit data from other database

Posted: Wed Jun 13, 2012 8:46 am
by admin
Johan,

I'm interested in knowing how you did it..

Steven

Re: show and edit data from other database

Posted: Wed Jun 13, 2012 9:12 am
by johan
Steven,

The same way I created all my reports. Only you have to add the name of the other DB in your sql.

ex: When I want to make a report in DB sample using data from the database clients my sql will be

Code: Select all

select * from clients.orders left join clients.adress .... 
This works perfect.

This works also for the browse screen (not the edit) when I create a new form.

Johan

Re: show and edit data from other database

Posted: Thu Jun 14, 2012 1:32 am
by admin
rui,

Are you using nuRunQuery()?


Steven

Re: show and edit data from other database

Posted: Thu Jun 14, 2012 9:14 am
by johan
Steven,

(I suspect your post was meant for me, not Rui? )


This is my complete sql used in PHP Data code of add activity

Code: Select all

$sql ="

CREATE TABLE #dataTable#  SELECT wl_loc_id, curdate() as datum, w.wl_start, l.loc_locatie, c.cl_naam, c.cl_voornaam, c.cl_telefoon, c.cl_gsm, p.pro_probleem, b.bes_beschikbaar,  CURDATE(),
    (YEAR(CURDATE())-YEAR(cl_geboortedatum))
   - (RIGHT(CURDATE(),5)<RIGHT(cl_geboortedatum,5))as leeftijd  from reg_begeleidingsteam.wachtlijsten w 
left join reg_begeleidingsteam.wachtlijst_locatie l on l.loc_id = w.wl_loc_id
left join reg_begeleidingsteam.clienten c on w.wl_cl_id = cl_id
left join reg_begeleidingsteam.problemen p on p.pro_id =  w.wl_probleem
left join reg_begeleidingsteam.beschikbaarheid b on b.bes_id = w.wl_beschikbaar where wl_eind is null order by wl_start";

nuRunQuery($sql);
so yes I used nuRunQuery()

Johan

Re: show and edit data from other database

Posted: Fri Jun 15, 2012 1:06 am
by admin
johan,

You are right, sorry about that.

Steven