[nycphp-talk] PHP Storing Query

DeWitt, Michael mjdewitt at
Fri Apr 25 10:22:28 EDT 2003

I'm not sure what you are are trying to do with storing  queries in a
database, but I think you mean storing query strings into a table.

If your queries are simple without any conditions, then this is a
strightforward matter of merely storing the text of the query as a string
value in an appropriate table structure. a query like "select * from foo"
should be easy to handle.

Most likely though, you have conditions and have queries that use a
condition, i.e., "select * from foo where bar=$bar" The question is whether
or not you want to store the query string before or after evaluating the
value of $bar.  It should be doable either way.

The issues you will face if this along the lines of what you want to do is
properly escaping the data to allow Access to accept your data and using the
PHP eval() function to allow embedded variables returned in a string from
the database to be interpreted as variables and not merely part of a string.

Again, I am not sure what you hope to gain by doing this, as you may find
better answers if you present your need or issue rather than asking for help
with a solution.

I use both ASP and PHP, and for me PHP is so much more capable (especially
under a *nix), I would stick with PHP and perhaps consider migrating your
data to a better DB like mysql or Postgres. Postgres supports views which
may be the db function you are trying to emulate?

Hope this helps.


> ----- Original Message -----
> From: Michael E Keszkowski <kesz1 at>
> Date: Thursday, April 24, 2003 10:28 am
> Subject: [nycphp-talk] PHP Storing Query
> > Hello;
> > 
> > I am adding a web (using php) interface to an existing MS Access 
> > database application.  Currently, databse is stored on a network 
> > drive and 10+ users query/update records daily.  Because some 
> > people cannot handle change very well (never mind a computer 
> > related change)  I would like to keep the existence database 
> > application and slowly migrate the users over to the web.
> > 
> > My problem is, the application was developed very poorly.  I need 
> > to know if I can (and how to) create a query online and save that 
> > query (sql statement) in the access database as a query itself.
> > 
> > thanks,
> > 
> > -- mike
> > 
> > 
> > 
> > 
> > 
> > 
> --- Unsubscribe at ---

More information about the talk mailing list