/ Published in: PHP
adapted from http://www.gotocode.com/art.asp?art_id=275&
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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; }