I have a Microsoft SQL database I can use (also mySQL, so if you know how to
do this in mySQL that is just as useful). The database can only be accessed
from webpages hosted on the same server as the SQL database because of
firewalling. The database admin doesn't mind me accessing it like this if I
can do it, and they would allow me if the firewall could be changed (which
it can't / won't be). However, I need to get direct access to the database
from a different webserver - there is no way around the firewall, and I
can't put the pages on the same webserver for other reasons which aren't
important.
Anyway, what I thought I could try would be a PHP page on the same webserver
as the SQL database. I could then call this page from other pages elsewhere
on the internet, send the query in a POST or GET string (probably post
because of the greater size), the PHP script then queries the SQL server,
and then somehow returns the result to the original calling page. I can't
really work out how to get the return values back to where they need to be,
although I thought putting them in a standard array rather than as database
objects would be easier.
The main problem i'm having is how to return the values to the other page
without calling away from that original page, and how to get the output into
an array or something I can use.
Basically, I would have a script on the server called say SQLinterp.php and
the calling page of mypage.php. These would work something like as follows:
SQLinterp.php:
>>>>>>>> Read in the query from POST data
Verify and then execute the query on the SQL server
Get the return values, put them into some sort of array
Somehow (magic?) get this array back for use in the other page
<<<<<<<<<<<<
mypage.php>>>>>>>>
Draw page headers.......
Query database for some values
Go through and use the database values for various constructions of the page
and tables
More queries
More use of the data
End of page
<<<<<<<<<<<<
Now, what I though I may be able to do is include this as an 'include'
file,so it just executes the query inline and the array it creates, or even
just the normal result, is accessible normally. There is a complication
though, in that I also need this (or a slightly modified version) to
function when called from a C++ application, so simply including it would
not help for this case.
Any ideas greatly appreciated.
Thanks
David