Get ready for BLACK FRIDAY shopping starting in

Forums

PHP

This topic is locked

Help Please: Conditional Transaction?

Posted 27 Jun 2007 21:21:50
1
has voted
27 Jun 2007 21:21:50 Jon O posted:
Hello all,

I am an amateur web-designer (self taught in the last 6 months) and am almost complete with my first data-base driven site. I am using Dreamweaver 8 and PHP/MySQL (along with the MX Kollection/InterAkt extensions). The last (and by far most frustrating) problem I have left is to determine how to create a conditional transaction. Meaning: I have 5 insert record transactions on one page (linked) that all insert into the same table. However, the user might not need all of the transactions (i.e. insert only two of them). They will definately use one, and at most five. I want the transaction to execute only if the corresponding field in the form is not blank (i.e. if the user supplies values for the first two fields, transactions 3, 4 and 5 will not execute AND it will not throw an error).

I have played around with adding "starting" triggers to the transactions but due to my inexperience I am unsure of the code. I believe it would look somthing like If: form1.fieldname = "" Then:. If someone could offer what they believe the code would be, or another solution, I would be extremely happy.

Thank you all in advance and I apologize for the lack of code/syntax knowledge. Any advice is extremely appreciated.

Replies

Replied 10 Jul 2007 10:05:29
10 Jul 2007 10:05:29 Steve Fuller replied:
Hi Jon,

Actually, you would use an (isset($varname)) for that. Here is a post i sent a day or two ago regarding another person's multiple insert issues. Keep in mind that this solutions was not how I had planned to accomplish the function, but time came into play. So I wrote a ""processing file". What I mean by this is that this file is located outside of the normal locations for functions and connections. Those files, for my tastes, are usually kept in functions.php and db_connect.php. SO have a look and see if this helps. It might get you thinking from a new angle...

www.dmxzone.com/forum/topic.asp?topic_id=38772

See ya,
Steve

Reply to this topic