I'm trying to use pear to make my code work on both Oracle and Mysql. The problem I'm having is that I can't describe a table using the query function.
$query = $db->query("describe booking");
//if query caused error, exit
if(DB::iserror($query))
{
die($query->getMessage());
}
This produces the error DB Error: syntax error, but works in MySQL. If I describe booking in Oracle SQL Plus, it works fine, as this is perfectly good sql code. The booking table is in no databases, the tables are just at the base-level so to speak.
$i=0;
//get rows from database
while($record = $query->fetchRow())
{
$record = array_change_key_case($record, CASE_LOWER);
if($dbtype == "mysqli")
{
echo "mysql problem<p />";
$field[$i] = trim($record['field']);
$i++;
}
else
{
echo "no problem<p />";
$field[$i] = trim($record['name']);
$i++;
}
}
The while loop here is not entered as the query doesn't work.
I need to find a way of describing the table in Oracle, but I can't remember how it's done. I think there is a way to do it using select.
select colname from ...where coltype = 'booking';
I seem to remember it started like that.
Nibinaear