<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Answer from: jackola</title>
    <link>http://qpost.com/my/advice/jackola</link>
    <description>web developer genius boy</description>
    <language>en-us</language>
    <item>
      <title>Re: SELECT MySQL data type?</title>
      <description>I will post the answer to my own question, since I figured it out and other may want to know:

$table = array();
$query = 'DESCRIBE tablename';
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_assoc($result)) {
	$table[$row['Field']] = $row['Type'];
}

The above gets the Field names and Types in an array. Next you get the actual data:

$query = 'select * from tablename where ID = ' . $_GET['id'];
$result = mysql_query($query) or die(mysql_error());
$actualdata = mysql_fetch_assoc($result);

Now you filter through both together, matching up the field name with the field type and actual data:

foreach($table as $field=&gt;$value) {
 echo $actualdata[$field] . ' is the value of the ' . $field . ' field, which is type ' . $value . '.';
}

Hope this helps others!</description>
      <author>jackola</author>
      <pubDate>Wed, 06 Aug 2008 22:36:35 +0000</pubDate>
      <link>http://qpost.com/q/select_mysql_data_type</link>
      <guid>78</guid>
    </item>
  </channel>
</rss>
