PDA

Click to See Complete Forum and Search --> : Running Quires through php


joefox
Feb 8th, 2007, 04:08 PM
Ok i have a excel form that connects to a database and querys it. And brings back the values into the excel form.
Is there a way to just connect via the php script? and not use excel.


Question 2, I use Excel to run Macros on a emulated termal program that uses Extra program.

Is there a way i can run the macro with php, and display the infomation in php?
Or is there a way i can, in php, click a button and have it execute the query in excel, and then save the file, and say "done" on the screen?

kows
Feb 9th, 2007, 02:01 AM
#1. it all depends on what type of database you're using -- but generally, of course you could execute the queries using php..

#2a. it depends what your macros do. you can't run excel macros through php, but you could still execute similar commands via php with the data retrieved from the database.

#2b. i doubt it. php can execute shell commands on the computer it is running from, but you can't get it to type stuff on your screen. php is a server sided language, it can't control anything outside of its environment (generally speaking).

in short; more information is needed.

visualAd
Feb 9th, 2007, 03:31 AM
http://uk.php.net/COM

You can access Excel files via PHP much the same way as you can via VBA. I would not recommend doing this in a production environment however because each request will create an instance of Excel and will probably bring the system to a grinding halt. (also - these only work on windows).

If your database is an Access database, you can access it through and ODBC DSN. Again, Access does not cope well with concurrent connections and if you need to use data from Access I recommend you create a scheduled task that runs a PHP script every 15mins, grabbing or updating the relevant data. Best place to put it is in a mysql database. But sqlite, csv files and even XML files are way more efficient than Access. :)

joefox
Feb 9th, 2007, 10:05 AM
If i can connect through excel, cant i just put that code from excel and add it to my php and connect to the db througt there?

visualAd
Feb 9th, 2007, 01:39 PM
You are better querying the database, as the integrity of the data is likely to be more reliable.