By rairai on
Hi,
I'd like to get fields from my table but not sure, how to do it with drupal.
With normal PHP:
$result=mysql_query("describe myTable");
while ($row=mysql_fetch_array($result)){
echo $row[0];
}
With drupal:
$result = db_query("DESCRIBE {myTable}");
while ($row=db_fetch_object($result)) {
//echo $row->what here?;
}
Comments
You can also use
You can also use db_fetch_array() instead of db_fetch_object so that you can access it via the [0] key.
Thanks for reply. I tried
Thanks for reply.
I tried that, but somehow nothing gets printed. Is there some bug in drupal?
Edit.
Nevermind, got it working with
echo $row['Field'];