How to I test a query on the fly

A

Anonymous

Guest
Hi All,

I would like to know if it is possible to test a query, hence without actually doing whatever it is I'm trying to do. For example:

I have a dynamically generated INSERT SQL-query, which should return a mysql_insert_id() after execution.
With this last id, a number of subentries are made. For these subentries, the id is absolutely necessary.

How can I test if the first query would return TRUE (for example) and hence could continue creating/updating the subrecords, without putting the whole thing in one big if..then..else-statement?

The last option seems especially difficult and complicated if not one, but several sublevels are used.

I have tried the MySQL/PHP manuals and Google, but actually I have no clue how to formulate what I am looking for.. :oops:

Any help or reading materials would be appreciated.

Thanks,

Cas
 
mollien said:
How can I test if the first query would return TRUE (for example) and hence could continue creating/updating the subrecords, without putting the whole thing in one big if..then..else-statement?

What you're after is what database people call Transactions. Unfortunately, MySQL doesn't currently have transaction capability (it's in the works), so there isn't a good way to do this. If you're desperate, you could use PostgreSQL, which does have transaction support.
 
Back
Top