Jump to content

Fetching Column Names


Skatecrazy1

Recommended Posts

[code]$c_sql="Select * from table where row  ='$row'";
  $res = @mysql_query($c_sql);
  $r = @mysql_fetch_array($res);
[/code]
actually i just re-read your post and think im missunderstanding you or your asking for the column names themselves or the data inside them?
Link to comment
https://forums.phpfreaks.com/topic/26776-fetching-column-names/#findComment-122452
Share on other sites

Here is a function from a class I have that will return field names in an array.
[code]
function get_rows($table) {
$result=mysql_query("DESCRIBE `".$table."`");
if (!$result) {
echo mysql_errno().": ".mysql_error();
}
$return=array();
while (($array=mysql_fetch_array($result)) !== false) {
$return[]=$array['Field'];
}
return $return;
}
[/code]

Monkeymatt
Link to comment
https://forums.phpfreaks.com/topic/26776-fetching-column-names/#findComment-122455
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.