HERE; return $output; } // end smartRToEditWhat makes

October 29, 2006 on 10:18 pm | In php |

function allows the user to type any index number into the textbox with- out any real indication what data correlates to that index. This versionbuilds a drop-down list showing operation names. The key value associatedwith those names is stored in the value attribute of each option. (Detailsto follow in the fieldToList()function.) The user doesn t have to knowanything about foreign key references or relational structures he simplychooses an operation from a list. That list is dynamically generated eachtime the user chooses to add a record, so it always reflects all the opera- tions in the agency. Neither a primary nor secondary key.In this case, I print a simple textboxso the user can input the value of the field. In all cases, the output willreflect the current value of the field. Working with the Primary KeyThe primary key value is much more important to the program than it is to theuser. I decided to display it, but not to make it editable in any way. Primary keysshould not be edited, but changed only by adding or deleting records. I relied upon some conventions to determine whether a field is a primary key. Iassumed that the first field of the record (field number 0) is the primary key. Thisis a very common convention, but not universal. Since I created the data design inthis case, I can be sure that the number 0 field in every table is the primary key. For that field, I simply printed the field name and value in an ordinary HTML tablerow. I added the key s value in a hidden field so the next program has access to it. Recognizing Foreign KeysUnfortunately, there is no way (at least in MySQL or SQLite) to determine if a fieldis a foreign key reference. I had to rely on a naming convention to make sure myprogram recognizes a field as a foreign key reference. I decided that all foreignkey fields in my database will have the foreign table s name followed by the valueID. For example, a foreign key reference to the operationtable will always becalled operationIDin my database. This is a smart convention to follow anyway, as it makes your field names easy toremember. It becomes critical in smartRToEdit()because it s the only way to tellwhether a field is a foreign key reference. I used an else ifclause to check thename of any field that is not the primary key (which was checked in the ifclause). The preg_match()function lets me use a powerful regular expressionmatch to determine the field s name.
Note: If you are looking for cheap and inexpensive provider to host and run your tomcat application check Actions tomcat hosting services

WordPress database error: [Table './sandzak_com_-_blog/wp_comments' is marked as crashed and should be repaired]
SELECT * FROM wp_comments WHERE comment_post_ID = '506' AND comment_approved = '1' ORDER BY comment_date

No Comments yet

TrackBack URI

Sorry, the comment form is closed at this time.

Powered by cheap hosting