Posted by Mike Youell on 04/10/06 18:38
As far as I'm aware there is no way to do it accept use the "describe"
function of mysql (or sql or whatever).
You can call this using the php mysql query command. I use mysqli in
PHP5, it becomes even easier then.
I haven't tested this but try the following:
// Initialise the type array to empty.
$TypeArray = array();
// Perform the mysql "describe" of the table Categories.
$QueryResult = $this->m_mysqli->query("describe Categories");
// Error checking for above function here, yada yada yada ;o)
// Convert the first result into an object.
$ResultObject = $QueryResult->fetch_object();
// If there was a result then...
while ($ResultObject !== NULL)
{
// Get the type...
$Type = $ResultObject->Type;
// And push it onto the type array.
array_push($TypeArray, $Type);
// Get the next result.
$ResultObject = $QueryResult->fetch_object();
}
[Back to original message]
|