/ Published in: PHP
adapted from http://www.gotocode.com/art.asp?art_id=275&
Expand |
Embed | Plain Text
function LoadTypeValues($table, $column) { global $db; // Create a SQL Query to get the Columns Type information, // Open a database connection, execute the query, and retrieve // the result. $sql = "show columns from $table like '$column'"; // Get the Type information, Remove "xxx(" from the front // and ")" from the end. Split the comma delimited values // into an array. $enum = $db->f('Type'); // For each value in the array, remove the leading and trailing // single quotes, convert two single quotes to one. Put the result // back in the array in the same form as CodeCharge needs. } } // return the values array to the caller return $values; }
Comments
Subscribe to comments
You need to login to post a comment.

I am a big fan of jQuery and have actually been able to grasp the concepts behind JavaScript... so when it came time to implement the jQuery plugin called Jeditables for my new php framework Commnetivity, i needed a way to dynamically generate the forms and also validate them.... using the concept of this snipplr entry, i was able to finally parse that dreaded enum value for my selectors. Thank you clapfouine for the contribution and Thank you snipplr.com for hosting it!