merefolk Posted October 4, 2008 Posted October 4, 2008 Can someone help me create a trigger for a database? The front end GUI where the person will be sending data can not be set to send in all caps, so I am trying to do it on the back end. Is this possible with MYSQL? Thanks, Adam Quote
TCH-Bruce Posted October 4, 2008 Posted October 4, 2008 Take a look at the strtoupper PHP command. Quote
merefolk Posted October 4, 2008 Author Posted October 4, 2008 The incoming data may not always be coming from a web page. Is there any way to add the trigger? Quote
TCH-Bruce Posted October 4, 2008 Posted October 4, 2008 You can always write a query after the fact to use the strtoupper on any fields in the database. Quote
merefolk Posted October 4, 2008 Author Posted October 4, 2008 That would work, but I am sort of a newbie on this. Where would I write the query to run after the table is updated? Quote
TCH-Bruce Posted October 4, 2008 Posted October 4, 2008 All you need to do is write an update query (PHP) and add it as a cron job. I'm sure you can Google for some samples on how to do it. Quote
OJB Posted October 4, 2008 Posted October 4, 2008 (edited) You say the data could be coming from anywhere, but surely you have a query at some point to add the data into the db? So in your insert query do something like this: >$query = ' INSERT INTO tbl_name (fld_name) VALUES(\''.strtoupper($the_value).'\')'; i.e. convert the string to uppercase as you insert it into the db or is this not what you want? if you want to write an update query it will be something like: >UPDATE tbl_name SET fld_name = UPPER(fld_name) WHERE fld_name = 'blahblah' Edited October 4, 2008 by OJB Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.