Skatecrazy1 Posted November 10, 2006 Share Posted November 10, 2006 well I know this is probably very easily looked up, but I'm short on time;is there any way to call the names of all the fields in a table into an array?thanks. Quote Link to comment Share on other sites More sharing options...
reaper7861 Posted November 10, 2006 Share Posted November 10, 2006 [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? Quote Link to comment Share on other sites More sharing options...
Monkeymatt Posted November 10, 2006 Share Posted November 10, 2006 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 Quote Link to comment Share on other sites More sharing options...
reaper7861 Posted November 10, 2006 Share Posted November 10, 2006 Ah yes sorry about that matt is on it already ::) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.