<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: chuck code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 29 Aug 2008 22:30:08 GMT</pubDate>
    <description>DZone Snippets: chuck code</description>
    <item>
      <title>Select some data from MySQL using PHP</title>
      <link>http://snippets.dzone.com/posts/show/1514</link>
      <description>This snippet basically will select some data from a MySQL table using PHP. A friend sent me a request to pull from PHPBB's tables, so this script was born.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;	$UserName = "@@@@@";&lt;br /&gt;	$PassWord = "$$$$$";&lt;br /&gt;	$DataBase = "%%%%%";&lt;br /&gt;	$HostName = "localhost"; // Unless your host is remote, use localhost.&lt;br /&gt;&lt;br /&gt;	$MySQLConnection = mysql_connect($HostName, $UserName, $PassWord) or die("Unable to connect to MySQL Database!!");&lt;br /&gt;&lt;br /&gt;	$MySQLSelectedDB = mysql_select_db($DataBase, $MySQLConnection) or die("Could not Set the Database!!");&lt;br /&gt;&lt;br /&gt;	$MySQLRecordSet = mysql_query("SELECT TOP 5 field_1, field_2 FROM some_phpbb_table");&lt;br /&gt;&lt;br /&gt;	while ($MyRow = mysql_fetch_array($MySQLRecordSet, MYSQL_ASSOC)) {&lt;br /&gt;		print "First Field: " . $MyRow{'field_1'} . " Second Field: " . $MyRow{'field_2'} . "&lt;br&gt;";&lt;br /&gt;	}&lt;br /&gt;	mysql_close($MySQLConnection);&lt;br /&gt;}&lt;br /&gt;?&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 17 Feb 2006 17:53:01 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1514</guid>
      <author>Mark (Mark)</author>
    </item>
  </channel>
</rss>
