<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/&quot;A0QCQnc-cSp7ImA9WhZTFks.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479</id><updated>2011-03-21T09:02:43.959+08:00</updated><title>Web Coding Tips - Guide For Web Programmers</title><subtitle type="html">A basic guide for web programmers using PHP, MySQL and Java for a variety of applications such as WordPress and Joomla. This is meant for beginners who would like to learn the PHP (Server-side HTML embedded scripting language. It provides web developers with a full suite of tools for building dynamic websites). Also included are tips on SEO or Internet Marketing that make use of Social Media applications such as Twitter, FaceBook and so on.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://web-coding-tips.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>115</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/WebCodingTips-GuideForWebProgrammers" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="webcodingtips-guideforwebprogrammers" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">WebCodingTips-GuideForWebProgrammers</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;DE8CQXwzcSp7ImA9WhZTFk4.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-7543268866520799821</id><published>2011-03-21T00:01:00.003+08:00</published><updated>2011-03-21T00:01:00.289+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-21T00:01:00.289+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="retrieving data using php" /><title>Retrieving Data Using PHP</title><content type="html">&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you use &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; statements with  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_query()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, the result set (as you expect to see  displayed on the mysql command line) is passed into result memory, and a result  identifier is returned. You normally store this in a variable called &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and use it to specify your result set in subsequent  function calls.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You've already seen how &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_fetch_row()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  returns a single row of data from a result set. The simple example in the last  chapter used a &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;while&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; loop to step through each row of a  result set for the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SHOW DATABASES&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; statement. Here's a  slightly more advanced version entitled &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;show_db.php.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You've already seen how &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_fetch_row()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  returns a single row of data from a result set. The simple example in the last  chapter used a &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;while&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; loop to step through each row of a  result set for the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SHOW DATABASES&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; statement. Here's a  slightly more advanced version entitled &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;show_db.php,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  which prints out information from the user table in the sample_db  database:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="982"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;include " ./common_db.inc";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$link_id = db_connect('sample_db');&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result = mysql_query("SELECT * FROM user", $link_id);&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;while($query_data  =  mysql_fetch_row($result)) {&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;echo "'", $query_data[1],"' is a ", $query_data[3], "&amp;lt;br&amp;gt;";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It returns the following:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;'Nicrot' is a Mid
'Spargy' is a Mid
'Pads' is a Winger
'Dodge' is a Link
'Mac' is a Winger
'Greeny' is a Utility back
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You begin by connecting to the server with &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;db_connect&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; (which is included in &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;common_db.inc&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;), specifying that you PPwant to use the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;sample_db&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; database. You query the database with the SQL  statement &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;"SELECT * FROM user",&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; whose result set is the  entire contents of the user table.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The variable &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; stores the returned  result identifier, with which you specify the result set when calling &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_fetch_row().&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; This in turn fetches the first row of  results, from which you echo the second and fourth fields (userid and  userposition, respectively). The internal pointer then moves to the next row,  and the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;while&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; loop cycles until all the rows in the  table have been fetched.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You can achieve the same result more efficiently by saying:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result = mysql_query("SELECT userid, userposition FROM user", $link_id);&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;while($query_data = mysql_fetch_row($result)) {&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;echo "'", $query_data[0] , "' is a ",$query_data[1],"&amp;lt;br&amp;gt;";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
}
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;By extracting only the fields in which you're interested, you save  both time and memory.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;PHP has two more functions that you can use to fetch data: &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_fetch_array()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_fetch_object().&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; Both basically work the same as &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_fetch_row(),&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; the only difference being their return  types. This is best illustrated by showing how the preceding example would look  if you'd used either of these other functions to fetch values from the result  set.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_fetch_array()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; returns a single  associative array from a result set, storing each entry in the record against  the respective field name. You'd therefore say:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;while($query_data = mysql_fetch_array($result)) {&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;echo "'", $query_data["userid"],"' is also known as ",&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$query_data["userposition"], "&amp;lt;br&amp;gt;";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="983"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_fetch_object()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; returns a single  object from a result set, storing each entry as a property of that object. The  properties are named according to the field name, so you might say:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;while($query_data = mysql_fetch_object($result)) {&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;echo "'",$query_data-&amp;gt;userid," ' is a ",&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$query_data-&amp;gt;userposition,"&amp;lt;br&amp;gt;";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;These two functions are particularly useful in situations where  you might need to alter the structure of the database tables. Unless you change  the names of the fields, you don't have to worry about the order in which they  appear in the table because you can fetch the field value by specifying its name  and not its index number. Although both functions are slightly slower than &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_fetch_row(),&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; they do have the added benefit of making  your scripts more readable (later in a long stretch of code, for example, you  might get confused about to which field is being referred to if you were just  specifying indices).&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;There's one more function that deserves a mention at this point:  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_result(),&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; which returns the value of a specified  field in a specified row. It takes the usual result indicator, plus a row number  and field name as its arguments. You could rewrite the example like this:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result = mysql_query("SELECT * FROM user", $link_id);
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;for($i  = 0;  $i &amp;lt; mysql_num_rows($result) ; $i++) {&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;echo  "'",  mysql_result($result, $i, "userid"),"' is a ,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_result($result, $i, "userposition"),"&amp;lt;br&amp;gt;";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
}
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You also have the option of doing it backward!&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result = mysql_query("SELECT * FROM user", $link_id);

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;for($i = mysql_num_rows($result)-1; $i &amp;gt;=0; $i--){&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   echo "'", mysql_result($result, $i, "userid"), " is a "',
   mysql_result($result, $i, "userposition"),"&amp;lt;br&amp;gt;";
}
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;And your result set will be:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;'Greeny' is a Utility back 
'Mac' is a Winger
'Dodge' is a Link 
'Pads' is a Winger 
'Spargy' is a Mid 
'Nicrot' is a Mid
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The field name argument can also be written as an integer  indicating the field's offset:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;echo   "'",   mysql_result($result, $i, 1),"' is a ", mysql_result($result, $i, 3),"&amp;lt;br&amp;gt;";
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Another way to jump straight to a specific row of data is to use  the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_data_seek()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function. It works in a similar  way to the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;fseek()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function, which you used in &lt;/span&gt;&lt;a class="chapterjump" href="http://www.blogger.com/post-create.g?blogID=995644850464800479" target="_parent"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Chapter 7&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; to  navigate within a file stream. It takes as arguments a result indicator and an  integer that indicates the position in the result set &lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="984"&gt;&lt;/a&gt;to move  to. As you might expect, the function returns &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;True&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; on  success and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;False&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; if you move past the array boundary.  Save this file as &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;show_seek.php&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and view it in your  browser:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;lt;?php
include "./common_db.inc";

$link_id = db_connect('sample_db');
$result = mysql_query("SELECT * FROM user", $link_id);

for($i = mysql_num_rows($result)-1; $i &amp;gt;=0; $i--){
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_data_seek($result,   $i);&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   $query_data  = mysql_fetch_array($result);
   echo "'", $query_data["userid"], "' is also known as",
   $query_data["username"], "&amp;lt;P&amp;gt;";
}
?&amp;gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You've now seen a number of different ways to access result sets  from your PHP scripts. With these techniques under your belt, you should be able  to deal with quite a broad range of situations, and show the data you want,  presented the way you want it. However, this is only half the story.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You already know that you can improve the efficiency of your  scripts by keeping the result sets small. You did this by specifying the fields  you wanted to view in the original &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  statement:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result = mysql_query("SELECT userid, username FROM user", $link_id);
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;What's more, you had to go to some trouble to show the  results in reverse order. What if you want them displayed alphabetically? The  mind boggles! You're going to save yourself a whole lot of bother if you can  arrange the data that gets put into the result set. In fact, there is a huge  variety of data manipulation that is almost certainly going to be more  efficiently performed by a well-constructed SQL query than by PHP itself, in  terms of both execution time and complexity. For that reason, let's get back to  some pure MySQL and take a look at what's possible with the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-7543268866520799821?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/7543268866520799821?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/7543268866520799821?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2011/03/retrieving-data-using-php.html" title="Retrieving Data Using PHP" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;CEcCQXwzfSp7ImA9WhZTEE4.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-8873505313365040201</id><published>2011-03-14T00:01:00.003+08:00</published><updated>2011-03-14T00:01:00.285+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-14T00:01:00.285+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="retrieving data from mysql using php" /><title>Chapter 10: Retrieving Data From MySQL using PHP</title><content type="html">&lt;div class="highlights"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Up to now, we've concentrated mainly on ensuring that you  can connect to MySQL, either through the client or through PHP's mysql  functions, and create and fill tables with data. One of the first SQL statements  you came across in &lt;/span&gt;&lt;a class="chapterjump" href="http://www.blogger.com/post-create.g?blogID=995644850464800479" target="_parent"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Chapter 9&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; was a basic &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  statement. There's quite a lot more you can do to precisely define the kind of  data you want to retrieve, and this chapter focuses on the different ways you  can use PHP scripts to get at the data stored in a MySQL database.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;We start off by looking at PHP's data retrieval functions, and  then take a close look at how to construct SQL &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  statements so that they access the data you want, arranged in the way you  want.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You'll learn how to limit the number of results returned, and  how to order and group them, and you'll build a "user record" viewer script  that'll enable you to navigate around the database tables you developed in the  last chapter.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-8873505313365040201?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/8873505313365040201?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/8873505313365040201?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2011/03/chapter-10-retrieving-data-from-mysql.html" title="Chapter 10: Retrieving Data From MySQL using PHP" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;DUUCQXk_fCp7ImA9Wx9aFE8.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-8081778186984996907</id><published>2011-03-07T00:01:00.012+08:00</published><updated>2011-03-07T00:01:00.744+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-07T00:01:00.744+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="internet security" /><title>Secure Password Generator</title><content type="html">&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;During the course of my work I frequently set or sign up for accounts on a variety of sites. Its a good practice to vary your passwords and make them hard enough so that hackers and other&amp;nbsp;scrupulous&amp;nbsp;people will find it impossible to break them.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Here are a few simple rules when making passwords:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;li&gt;Use tools that automatically generate random passwords.&lt;/li&gt;
&lt;li&gt;Use alphanumeric characters and unique symbols to create stronger passwords.&lt;/li&gt;
&lt;li&gt;Instead of mnemonics, try a pass-phrase.&lt;/li&gt;
&lt;li&gt;Change passwords periodically.&lt;/li&gt;
&lt;li&gt;Avoid generating passwords using personal information.&lt;/li&gt;
&lt;/span&gt;&lt;/ul&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;For convenience, you can also try this &lt;a href="http://strongpasswordgenerator.com/"&gt;online password generator&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-8081778186984996907?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/8081778186984996907?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/8081778186984996907?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2011/03/secure-password-generator.html" title="Secure Password Generator" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;CEMCQH45fSp7ImA9Wx9bGE8.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-3652279825837976032</id><published>2011-02-28T00:01:00.003+08:00</published><updated>2011-02-28T00:01:01.025+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-28T00:01:01.025+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="internet marketing" /><title>Free Internet Marketing Videos</title><content type="html">&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Yesterday, I just got back from a *private*&amp;nbsp;Affiliate event in Vegas. Great networking.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;While at the event, I got to meet and hang out&amp;nbsp;with a lot of successful online marketers.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;But, one guy stood out amongst all the rest.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;He is a CRUSHER -- made over $10 million&amp;nbsp;online. Yet, you'd *never* know it by meeting&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;him.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Super nice guy.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;He's not an Internet Marketing "guru". Chances&amp;nbsp;are you've never heard of him.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;People love his straight forward approach to&amp;nbsp;making money. His training videos are very&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;easy to follow and filled with stuff you can&amp;nbsp;implement right away.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;For example, hit the link below and check out&amp;nbsp;these 5 free videos:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1cogeaTnWgcD0P&amp;amp;b=TnR8eU8wulPtdwDzo.eolw"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1cogeaTnWgcD0P&amp;amp;b=TnR8eU8wulPtdwDzo.eolw&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Note: You'll need to opt-in to get access to all&amp;nbsp;the videos, but it's well worth it. Don't worry,&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;you are not going to get a bunch of stupid&amp;nbsp;emails. This guy is different. You'll get a lot of&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;value and stuff you can actually use.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Go check it out now before you forget about it:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1cogeaTnWgcD0P&amp;amp;b=TnR8eU8wulPtdwDzo.eolw"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1cogeaTnWgcD0P&amp;amp;b=TnR8eU8wulPtdwDzo.eolw&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-3652279825837976032?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/3652279825837976032?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/3652279825837976032?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2011/02/free-internet-marketing-videos.html" title="Free Internet Marketing Videos" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;DUECQXY-cSp7ImA9Wx9bEkw.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-2233649289492972302</id><published>2011-02-21T00:01:00.003+08:00</published><updated>2011-02-21T00:01:00.859+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-21T00:01:00.859+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="online lead finder" /><title>Online Lead Finder - Ready For Download</title><content type="html">&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You asked me to let you know when I will be allowing people to download the&amp;nbsp;Online Lead Finder again.... well I am back and its now open!!&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://www.onlineleadfinder.com/"&gt;www.onlineleadfinder.com&amp;nbsp;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Please register for the free members area, so you can download it.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;We have some amazing updates that will be released also over the next months. &amp;nbsp;Remember the only way to get these updates is to stay on my mailing list - Don't worry, we wont spam you !&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Enjoy the software.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-2233649289492972302?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/2233649289492972302?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/2233649289492972302?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2011/02/online-lead-finder-ready-for-download.html" title="Online Lead Finder - Ready For Download" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;CE8CQHw6eCp7ImA9Wx9UFkw.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-5010807905606255701</id><published>2011-02-14T00:01:00.006+08:00</published><updated>2011-02-14T00:01:01.210+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-14T00:01:01.210+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="internet marketing" /><title>Trademarks in Domain Names?</title><content type="html">&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Personally, I think it's a bad (risky) idea to use a&amp;nbsp;trademarked name in your domain name.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You are just asking for trouble.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This is a perfect example:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1czW2OFFmgcD0P&amp;amp;b=jUZq1SrxoEnDH5GcnZsjFQ"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1czW2OFFmgcD0P&amp;amp;b=jUZq1SrxoEnDH5GcnZsjFQ&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;But, the tactic they reveal to you is totally *killer*.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It works UNBELIEVABLY well -- nothing sneaky, shady or&amp;nbsp;illegal here either.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you want lots of good traffic (for pennies per&amp;nbsp;click) check out this little loophole.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This video explains how it works:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1czW2OFFmgcD0P&amp;amp;b=jUZq1SrxoEnDH5GcnZsjFQ"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1czW2OFFmgcD0P&amp;amp;b=jUZq1SrxoEnDH5GcnZsjFQ&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;I'd go watch this now if I were you.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Why?&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;As you probably know, Google recently went&amp;nbsp;postal on a bunch of websites that included&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;the word "Google" in the domain name.&amp;nbsp;Lawsuits galore. Those sites all got taken down.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Once you visit this site, you'll know what I mean:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1czW2OFFmgcD0P&amp;amp;b=jUZq1SrxoEnDH5GcnZsjFQ"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1czW2OFFmgcD0P&amp;amp;b=jUZq1SrxoEnDH5GcnZsjFQ&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Dangerous move using that domain name...&amp;nbsp;wouldn't you say?&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;P.S. - The guy behind this is a *really* sharp online&amp;nbsp;marketer. I'm surprised that he chose to use that&amp;nbsp;domain name. But, the guy a genius. So, I'm sure he has&amp;nbsp;his reasons.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Go check out the video now before "Big G" steps in&amp;nbsp;and puts the brakes on this:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1czW2OFFmgcD0P&amp;amp;b=jUZq1SrxoEnDH5GcnZsjFQ"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1czW2OFFmgcD0P&amp;amp;b=jUZq1SrxoEnDH5GcnZsjFQ&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-5010807905606255701?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/5010807905606255701?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/5010807905606255701?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2011/02/trademarks-in-domain-names.html" title="Trademarks in Domain Names?" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;AkcCQX0yfyp7ImA9Wx9UEE0.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-2594811582254357159</id><published>2011-02-07T00:01:00.003+08:00</published><updated>2011-02-07T00:01:00.397+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-07T00:01:00.397+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="online lead finder" /><title>Online Lead Finder Software - Enhancement Requests</title><content type="html">&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;I just wanted to let you know that we will be continuing to update the Online Lead Finder software this year.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;I wanted to ask if you had any suggestions for enhancements or new ideas to help make it the better. Please also let me know why you want the feature enhancement, and how you would use it . &amp;nbsp;If your idea is considered, I will give you a &lt;a href="http://www.onlineleadfinder.com/?rid=5336"&gt;Free FULL copy of the software&lt;/a&gt;!&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Let me know at &amp;nbsp;onlineleadfinder@gmail.com&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;I look forward to hearing from you.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-2594811582254357159?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/2594811582254357159?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/2594811582254357159?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2011/02/online-lead-finder-software-enhancement.html" title="Online Lead Finder Software - Enhancement Requests" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;CUUCQXkzcCp7ImA9Wx9VFE0.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-583600820852219335</id><published>2011-01-31T00:01:00.016+08:00</published><updated>2011-01-31T00:01:00.788+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-31T00:01:00.788+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="magic bullet system" /><title>Magic Bullet System - Bonuses</title><content type="html">&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you read my e-mail yesterday, you should&amp;nbsp;already know about this...&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Amish Shah's Magic Bullet System goes live&amp;nbsp;today at 3PM Eastern.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;I put together a BIG bonus for you when you&amp;nbsp;order The Magic Bullet System through my link&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;(see below, only 25 available).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;As I'm sure you already know, throughout&amp;nbsp;2009 everyone was talking about...&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt;&amp;gt;&amp;gt; CPA MARKETING&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The problem?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;CPA marketing takes a lot of manual work.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;And nobody gives you all the tools you need to&amp;nbsp;get the job done, quickly and easily.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Well... today, that has changed.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The Magic Bullet automates the process, which&amp;nbsp;means you will crank out more money-making CPA&amp;nbsp;profit centers, faster than ever before.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Once you combine The Magic Bullet System&amp;nbsp;with my bonuses below, you'll be on the fast-&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;track to CPA success:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt;&amp;gt; Bonus #1: Private, closed door "CPA Money&amp;nbsp;Fast-Track" teleseminar with Amish Shah&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt;&amp;gt; Bonus #2: Private, CPA Money Mastermind&amp;nbsp;Think-Tank&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt;&amp;gt; Bonus #3: LIFETIME ACCESS to PPC Kahuna&amp;nbsp;(worth several thousand dollars)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;To claim these bonuses, just hit the link below&amp;nbsp;and order The Magic Bullet:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1ehvQrMN7gcD0P&amp;amp;b=J8jaJDcfU.RZB60G9p2iMQ"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1ehvQrMN7gcD0P&amp;amp;b=J8jaJDcfU.RZB60G9p2iMQ&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;There are only 25 of these bonuses available.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;(once you place your order using the above link,&amp;nbsp;send your email receipt to support@traffickahuna.com)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;I look forward to personally working with you&amp;nbsp;to ensure that you CRUSH IT in 2011 using The&amp;nbsp;Magic Bullet as your secret weapon.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Go here now for details and to reserve your&amp;nbsp;spot:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1ehvQrMN7gcD0P&amp;amp;b=J8jaJDcfU.RZB60G9p2iMQ"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1ehvQrMN7gcD0P&amp;amp;b=J8jaJDcfU.RZB60G9p2iMQ&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;*&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Time is running out (no joke).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;I just got word that The Magic Bullet System will be&amp;nbsp;sold out at midnight Eastern tonight (or sooner).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Obviously, the demand for this is HUGE.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt;&amp;gt; Bonuses still available...&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you think you are too late to get my awesome&amp;nbsp;"Success Booster" bonuses, you are not too late.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;We've decided to add another 25 spots since the first&amp;nbsp;25 spots were gone within the first hour! It's only&amp;nbsp;fair.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Just make sure that you place your order before&amp;nbsp;midnight tonight, so that you don't miss out:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1eZWXsErtgcD0P&amp;amp;b=hmYDKyoyyDTG7vmJZTf0Kw"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1eZWXsErtgcD0P&amp;amp;b=hmYDKyoyyDTG7vmJZTf0Kw&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt;&amp;gt; Can I afford it?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Yes. These guys offer a sweet payment plan that makes&amp;nbsp;this affordable to almost everyone. Several people&amp;nbsp;who already ordered through my affiliate link are&amp;nbsp;taking the monthly payments versus one payment.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt;&amp;gt; Is there a guarantee?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Yes. To put you at ease, there is a generous guarantee.&amp;nbsp;Nobody is trying to trick you here. Put The Magic Bullet&amp;nbsp;System to the test. Give it a shot. You are in complete&amp;nbsp;control.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt;&amp;gt; Here's what you need to do right away...&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;To claim your bonuses from me, just hit the link below&amp;nbsp;and order The Magic Bullet System:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1eZWXsErtgcD0P&amp;amp;b=hmYDKyoyyDTG7vmJZTf0Kw"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1eZWXsErtgcD0P&amp;amp;b=hmYDKyoyyDTG7vmJZTf0Kw&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;(once you place your order using the above link,&amp;nbsp;send your email receipt to&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;support@traffickahuna.com)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;I look forward to personally working with you&amp;nbsp;to ensure that you CRUSH IT in 2011 using The&amp;nbsp;Magic Bullet as your secret weapon.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Go here now for details and to reserve your&amp;nbsp;spot:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1eZWXsErtgcD0P&amp;amp;b=hmYDKyoyyDTG7vmJZTf0Kw"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1eZWXsErtgcD0P&amp;amp;b=hmYDKyoyyDTG7vmJZTf0Kw&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;P.S. - If you would like more information about&amp;nbsp;the "Success Booster" bonuses you will receive from&amp;nbsp;us, visit the blog here:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1eZWXsErtgcD0P&amp;amp;b=K2LM0w4qmy.aBw8H12bG0A"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1eZWXsErtgcD0P&amp;amp;b=K2LM0w4qmy.aBw8H12bG0A&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Whatever you do, do it fast because time REALLY IS&amp;nbsp;running out on this!&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-583600820852219335?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/583600820852219335?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/583600820852219335?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2011/01/magic-bullet-system-bonuses.html" title="Magic Bullet System - Bonuses" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;AkMCQX8zeyp7ImA9Wx9WF0Q.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-9117529665631259988</id><published>2011-01-24T00:01:00.006+08:00</published><updated>2011-01-24T00:01:00.183+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-24T00:01:00.183+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="internet marketing" /><title>What is the Purpose of Your Blog for Building Your Business?</title><content type="html">&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Tomorrow (Monday, Jan 25th) you will be hearing&amp;nbsp;a lot about Amish Shah's Magic Bullet System.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;That's why I wanted you to read this email&amp;nbsp;TODAY before all the craziness kicks in.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;As usual, everyone and their uncle is going to&amp;nbsp;be offering you various bonuses.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;But NOTHING like these "Success Booster"&amp;nbsp;bonuses, I can assure you.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Read all about them here:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1cXbdu4HBgcD0P&amp;amp;b=07X9wXh5bWfPUdUeKqhMyA"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1cXbdu4HBgcD0P&amp;amp;b=07X9wXh5bWfPUdUeKqhMyA&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;As you will see, my partner and I are putting a&amp;nbsp;lot on the table here -- investing *months* of our&amp;nbsp;personal time -- working with you to put you on&amp;nbsp;the CPA-money fast-track to success.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You'll also get *lifetime* access to our powerful&amp;nbsp;Pay-Per-Click system and software... and more!&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This is *not* your usual ho-hum bonus.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Get all the details and read this blog post:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1cXbdu4HBgcD0P&amp;amp;b=07X9wXh5bWfPUdUeKqhMyA"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1cXbdu4HBgcD0P&amp;amp;b=07X9wXh5bWfPUdUeKqhMyA&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;I hope you decide to grab one of the 25&amp;nbsp;available spots and join us.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-9117529665631259988?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/9117529665631259988?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/9117529665631259988?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2011/01/what-is-purpose-of-your-blog-for.html" title="What is the Purpose of Your Blog for Building Your Business?" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;CUECQXw-fSp7ImA9Wx9WEUQ.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-3861056100121804524</id><published>2011-01-17T00:01:00.008+08:00</published><updated>2011-01-17T00:01:00.255+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-17T00:01:00.255+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="easy button" /><category scheme="http://www.blogger.com/atom/ns#" term="traffic bot software" /><title>Easy Button - Traffic Bot Software</title><content type="html">&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Over the past 9 years, I've been involved in&amp;nbsp;many software projects.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Some simple. Some very complex.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;But, I've NEVER seen a *monster* like this.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;A few minutes ago, I watched a video about a guy&amp;nbsp;who doubled his profits in just 8 days (which puts&amp;nbsp;an extra $171,272.60 in his pocket per year).&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;How did he do it?&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It took 5 minutes, using his ingenious Easy Button&amp;nbsp;"traffic bot" software.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This software automatically grabs what keywords to&amp;nbsp;use, what to promote, builds a blog for you.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Then, it tweaks everything automatically -- to squeeze&amp;nbsp;out even *more* traffic and profits.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;IT'S UNREAL!&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you've ever wanted an online marketing&amp;nbsp;"Easy Button", this is it:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1bp0.xTBVgcD0P&amp;amp;b=XfogpWzkozAc4Igjio.ghA"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1bp0.xTBVgcD0P&amp;amp;b=XfogpWzkozAc4Igjio.ghA&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If I tried to describe this software to you, it would&amp;nbsp;seem unbelievable or over-the-top.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;That's why you really need to see this in action&amp;nbsp;(like I did, by watching this video) to truly&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;believe it:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1bp0.xTBVgcD0P&amp;amp;b=XfogpWzkozAc4Igjio.ghA"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1bp0.xTBVgcD0P&amp;amp;b=XfogpWzkozAc4Igjio.ghA&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This thing is a beast. Crazy powerful and totally automated.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You'll see.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-3861056100121804524?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/3861056100121804524?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/3861056100121804524?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2011/01/easy-button-traffic-bot-software.html" title="Easy Button - Traffic Bot Software" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;Ak8CQXg6fCp7ImA9Wx9XFUU.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-7184051275332738021</id><published>2011-01-10T00:01:00.011+08:00</published><updated>2011-01-10T00:01:00.614+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-10T00:01:00.614+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="creating mysql databases and tables" /><title>Creating Databases and Tables From MySQL</title><content type="html">&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Let's go back to the command line to construct a database  from the mysql client. To create a database called sample_db, you just have to  say:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; CREATE DATABASE sample_db;
Query OK, 1 row affected (0.05sec)
mysql&amp;gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Removing it is just as simple:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; DROP DATABASE sample_db;
Query OK, 0 rows affected (0.00sec)
mysql&amp;gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The number of rows mysql counts as having been affected doesn't  include the ones it has removed. You could have just deleted thousands of data  entries, but from the information presented here, you'd have no way of knowing!  This is all the more reason to use extreme caution—this small, harmless-looking  &lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="955"&gt;&lt;/a&gt;command will totally wipe out the specified database and all the  tables in it, and won't even hint at what it's done, let alone ask you for  confirmation. You have been warned!&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Assuming you just got rid of your sample_db database, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;CREATE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; it again. You'll use it rather a lot in the next  couple of chapters, and the rest of the examples in this chapter take you  through the steps to set it up with a structure and records.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Creating a database table is a little more complicated. Let's say  you want to create a table called user. Start off with the obvious syntax:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; CREATE TABLE user;
ERROR 1113: A table must have at least 1 column
mysql&amp;gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Okay, you're going to need a little more than that. Although a  database can quite happily exist without any tables living under its roof,  tables are rather more fussy. Give it some structure by putting a list of the  field descriptors within parentheses following the table name. The field  descriptors each follow the form:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;fieldname TYPE(length)
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;For example, you could create a very simple two-field table  with:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; CREATE TABLE test_table (name CHAR(40), number INT);
Query OK, 0 rows affected (0.06sec)
mysql&amp;gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You already had a look at the various types of variables supported  by MySQL. You also have the option of specifying attributes for each of the  fields—to do so, simply append them to the descriptor. You can use any  combination of the attributes described in the following table.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informaltable"&gt; &lt;table border="1"&gt;&lt;thead&gt;
&lt;tr valign="top"&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Attributes&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Description&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt; &lt;tbody&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;BINARY&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Makes the field's value case-sensitive. Works only with CHAR  and VARCHAR type fields&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL, or NOT NULL&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NOT NULL fields cannot take a NULL value. Fields that are  declared NULL will store a specified default value whenever a NULL value is  given. If there is no default value provided, they simply store NULL.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If unspecified, NULL is assumed&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DEFAULT &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;default_value,&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Specifies the default value to store when NULL is  given&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;AUTO_INCREMENT&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;When a NULL value is placed in an AUTO_INCREMENT field, the  field value is set to one greater than its current maximum value in that table.  AUTO_INCREMENT only works with unique, integer type fields&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;There can be only one AUTO_INCREMENT field per  table&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;After you've listed all those that you need, you can specify  selected fields as holding indexes, primary keys, and unique values. Here's a  quick recap of what each of these entails:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="956"&gt;&lt;/a&gt; &lt;/span&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;KEY/INDEX&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: These are synonymous  keywords that specify fields to be used as indexes. The specified field entries  are copied to a separate index table, where they're listed against pointers to  the corresponding entries in the original table. They're then sorted, producing  an index much the same as you'd find in the back of a book. If you specify  multiple fields (&lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;"field1"&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;"field2"&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;,...) for your index, the index sorts first on &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;"field1"&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, and then any duplicate values in &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;"field1"&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; are sorted on &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;"field2"&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, and  so on.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;PRIMARY KEY&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: You can specify  exactly one field in any given table as a primary key; it is then be used as an  index of unique values. Consequently, each entry can be used in other tables as  a unique reference to the record to which it belongs—it's essentially the glue  that holds a relational database together. To use a field as a primary key, it  must be declared &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NOT NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;. Once again, if you pass more  than one field name when defining a primary key, the specified field names are  combined to create a primary key.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UNIQUE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: The value of each entry in  a unique field must be unique among all other entries in the same field. That  is, if one record's entry in the field contains the value &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, it's guaranteed that no other entry in that field will  have the same value. As mentioned, uniqueness is a requirement for &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;AUTO_INCREMENT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; fields.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;In the course of the next couple of chapters, you'll see a lot of  examples based around a homemade relational database comprising two tables. The  first is called user, and it serves as a record of all users registered on an  imaginary Web server. The other, access_log, contains relative paths to the Web  pages each user accesses, plus counters measuring how many times she visits each  page. Both tables are housed in the sample_db database.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The first table, user, is structured as follows:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informaltable"&gt; &lt;table border="1"&gt;&lt;thead&gt;
&lt;tr valign="top"&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Field&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Type&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Null&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Attributes&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt; &lt;tbody&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Usernumber&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MEDIUMINT(10)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;no&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;AUTO_INCREMENT&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Userid&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR(8)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;no&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;BINARY&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Userpassword&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR(20)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;no&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;BINARY&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Username&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR(30)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;no&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;none&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Userposition&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR(40)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;no&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;none&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Useremail&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR(50)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;no&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;none&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Userprofile&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR(250)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;no&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;none&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The usernumber field has an &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;AUTO_INCREMENT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; attribute, so the field is automatically  incremented (that is, its value increased by 1) whenever a new record is  inserted with a &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; value in the first field. For  example, when a new user registers and his record is added to the user table,  the user number assigned will be one more than the largest number that's already  in the table. You also declare this field &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UNIQUE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;,  ensuring that no two rows can have the same value.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The fields userid and userpassword are both variable-length  strings (lengths specified as 8 and 20 characters, respectively). They are  declared &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;BINARY&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, and are therefore case-sensitive. By  default, character fields are case-insensitive.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="957"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The userid field will be defined as a primary key and used to  establish a relationship with the access_log table, which also has a userid  field.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The userposition field describes the position that a player on the  team holds—in the example there are values such as Mid and Link, but you could  easily modify this to football positions such as quarterback or wide receiver if  your database was used to store information about an American football team.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The second table, access_log, is defined as follows:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informaltable"&gt; &lt;table border="1"&gt;&lt;thead&gt;
&lt;tr valign="top"&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Field&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Type&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Null&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Attributes&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt; &lt;tbody&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;page&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR(250)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;no&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;None&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;userid&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR(8)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;no&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;BINARY&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;visitcount&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MEDIUMINT(5)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;no&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;None&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;accessdate&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;TIMESTAMP(14)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;yes&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;None&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;A &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;TIMESTAMP&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; type field can always take a  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; value because it stores the current system time in  YYYMMDDhhmmss format when a new record is inserted, or an existing record is  updated, unless it is explicitly given a date and time to store.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The access_log table has the same userid field as the user table.  The userid field serves as the key to define a relationship between the two  tables.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Now that you've defined the structures of the tables, let's create  them and their home, the sample_db database.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;blockquote class="blockquote"&gt; &lt;div class="first-para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you're dreading the prospect of typing  in the following 12-line SQL statement (because you don't want to have to retype  the whole thing when it doesn't work the first time), here are a couple of  suggestions.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you're running PHP from UNIX, use the &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;edit&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;command from  the mysql command line, which calls the text editor of your choice (this command  doesn't work on Windows). This is held in the &lt;/span&gt;&lt;/i&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$&lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;EDITOR&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;environment variable, and is  typically the vi editor: &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt;  edit&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;. If you make a typo, just reissue the edit  command again. Your editor still has what you previously typed in.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The previous command is remembered by the mysql  client program. You can go back a single line by pressing the up arrow key.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You can save your lines of SQL in a text  file and feed it to the mysql client: &amp;gt; &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql uphpuser pphppass hlocalhost &amp;lt; query.sql&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The following &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;CREATE TABLE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command  creates the user table in the sample_db database:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; CREATE TABLE user (&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt;     usernumber MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt;     userid VARCHAR(8) BINARY NOT NULL,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt;     userpassword VARCHAR(20) BINARY NOT NULL,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="958"&gt;&lt;/a&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt;    username VARCHAR(30) NOT NULL,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt;    userposition VARCHAR(50) NOT NULL,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt;    useremail VARCHAR(50) NOT NULL,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt;    userprofile TEXT NOT NULL,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt;    PRIMARY KEY (userid),&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt;    UNIQUE usernumber (usernumber)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt; );&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Query OK, 0 rows affected (0.69 sec)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The following &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;CREATE TABLE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command  creates the access log table:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; CREATE TABLE access_log (&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt;     page VARCHAR(250) NOT NULL,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt;     userid VARCHAR(8) BINARY NOT NULL,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt;     visitcount MEDIUMINT(5) DEFAULT '0' NOT NULL,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt;     accessdate TIMESTAMP(14),&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-&amp;gt;     PRIMARY KEY (userid, page));&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Query OK, 0 rows affected (0.00 sec)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The userid in the access_log table isn't declared as a primary key  or a unique value because a user can access multiple Web pages, and each visited  Web page constitutes a record in the table. Instead, the combination of userid  and page is defined as the primary key.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="959"&gt;&lt;/a&gt;Creating the Sample Database and Tables  with PHP&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If all has gone according to plan, you are now the proud  owner of a couple of tables, user and access_log. All well and good, but is the  main topic slipping away? The fact is that it's just as easy to generate these  tables from PHP scripts. Let's see how you might create the same database and  tables using PHP instead of the mysql client.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;First, you need a way to issue queries to the MySQL server from  within PHP. The &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_query()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function is for precisely  that purpose. It takes a query string as its first argument, and makes that  query on the currently selected database, using the link identifier specified as  the second argument. (As usual, you can omit the identifier, in which case the  last opened link is assumed.) If no link is currently open, it attempts to  establish a connection first.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;blockquote class="blockquote"&gt; &lt;div class="first-para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Do not use semicolons to terminate query  strings when using them as arguments to PHP functions because they may cause  your script to kick up errors.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If the given query is successfully executed,  &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_query()&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;returns a non-zero value pointing to the returned result set, or  &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;False&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;upon  error. The following call is equivalent to having made the query &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SHOW DATABASES&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;in  the mysql client:&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$link_id = db_connect();
$result = mysql_query("SHOW DATABASES", $link_id);
while($query_data = mysql_fetch_row($result)) {
  echo $query_data[0],"&amp;lt;P&amp;gt;";
}
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="960"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This passes the expected list of databases to a table, returning a  pointer to that table. You then just fetch each row and echo it out. It should  look like this:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql
sample_db
test
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$link_id&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; could have been omitted from the  previous code snippet because the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_query()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  function would have defaulted to the last opened connection.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you want to specify the name of the database to issue a query  on, you can use the PHP function &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_db_query()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; like  this:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result = mysql_db_query("sample_db", "SHOW TABLES");
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This call returns the list of tables available in the sample.db  database—even if you haven't used &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_select_db()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; to  select it explicitly.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You can also use &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_query()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; to create  and drop databases:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result = mysql_query("CREATE DATABASE dummy_db");
$result = mysql_query("DROP DATABASE dummy_db");
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;PHP provides you with another alternative—a pair of functions  specifically designed for creating and dropping databases: &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_create_db()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_drop_db()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;. Both take the name of a database to be  created or dropped as the first argument, followed by an optional link  identifier, and return &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;True&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; if a database is  successfully created/dropped and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;False&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; upon error. For  example:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$link_id = db_connect();
if(!mysql_create_db("dummy_db", $link_id)) die(sql_error());
                       echo "Successfully created the database dummy_db.";
if(!mysql_drop_db("dummy_db", $link_id)) die(sql_error());
                       echo "Successfully dropped the database dummy_db.";
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="example"&gt;&lt;span class="example-title"&gt;&lt;span class="example-titlelabel"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Try  it Out: &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Create a Database and Tables&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="961"&gt;&lt;/a&gt;  &lt;/span&gt;&lt;div class="formalbody"&gt; &lt;table border="0" cellpadding="0" cellspacing="0" class="BlueLine"&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td bgcolor="#000080" class="bluecell"&gt;&lt;span style="color: #010100; font-size: x-small;"&gt;&lt;b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;img alt="Start example" border="0" height="2" src="" width="1" /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The following script is an alternative to your earlier  exploits at the command line. First, it creates the sample_db database, and then  it defines the tables user and access_log as specified previously.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;include "./common_db.inc";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$dbname = "sample_db";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$user_table = 'user';&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$user_table_def = "usernumber MEDIUMINT(10)DEFAULT '0' NOT NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;AUTO_INCREMENT,";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$user_table_def .= "userid VARCHAR(8) BINARY NOT NULL,";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$user_table_def .= "userpassword VARCHAR(20) BINARY NOT NULL,";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$user_table_def .= "username VARCHAR(30) NOT NULL,";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$user_table_def .= "userposition VARCHAR(50) NOT NULL,";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="962"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$user_table_def .= "useremail VARCHAR(50) NOT NULL, ";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$user_table_def .= "userprofile TEXT NOT NULL,";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$user_table_def .= "PRIMARY KEY (userid),";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$user_table_def .= "UNIQUE usernumber (usernumber)";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$access_log_tablename = "access_log";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$access_log_table_def = "page VARCHAR(250) NOT NULL,";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$access_log_table_def .= "userid VARCHAR(8) BINARY NOT NULL, ";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$access_log_table_def .= "visitcount MEDIUMINT(5) DEFAULT '0' NOT NULL,";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$access_log_table_def .= "accessdate TIMESTAMP(14),KEY page (page),";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$access_log_table_def .= "PRIMARY KEY (userid, page)";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$link_id = db_connect();&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if(!$link_id) die(sql_error());&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if(!mysql_query("CREATE DATABASE $dbname")) die(sql_error());&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;echo "Successfully created the $dbname database.&amp;lt;BR&amp;gt;";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if(!mysql_select_db($dbname)) die (sql_error());&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if(!mysql_query("CREATE TABLE $user_tablename ($user_table_def)"))&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
                                                      &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;die(sql_error());&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if(!mysql_query("CREATE TABLE $access_log_tablename ($access_log_table_def)"))&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
  &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;die (sql_error());&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;echo "Successfully created the $user_tablename and $access_log_tablename&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;tables.";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Assuming that you followed along with the command line example,  running this script would generate a nice friendly error:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;1007: Can't create database 'sample_db'. Database exists
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;To overcome this, simply go back to the command, and use the mysql  client to &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DROP&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; the sample_db database, and then run the  script again. You should see the following output:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Successfully created the sample_db database.&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
Successfully created the user and access_log tables.
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="BlueLine"&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td bgcolor="#000080" class="bluecell"&gt;&lt;span style="color: #010100; font-size: x-small;"&gt;&lt;b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;img alt="End example" border="0" height="2" src="" width="1" /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="BlankSpace"&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td height="16"&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="963"&gt;&lt;/a&gt;How it Works&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The script is very straightforward. It begins by including  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;common_db.inc&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, giving you use of the functions &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;db_connect()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;sql_error()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, which  you defined earlier:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;lt;?php
include "./common_db.inc";
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="964"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You then define the variables that describe the two tables. This  is where all the hard work pays off—you just have to specify the same field  descriptors that you did at the command line:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$dbname = "samp1e_db";
$user_tablename = "user";
$user_table_def = "usernumber MEDIUMINT(10) DEFAULT '0' NOT NULL
AUTO_INCREMENT,";
$user_table_def .= "userid VARCHAR(8) BINARY NOT NULL, ";
$user_table_def .= "userpassword VARCHAR(20) BINARY NOT NULL,";
$user_table_def .= "username VARCHAR(30) NOT NULL,";
$user_table_def .= "userposition VARCHAR(50) NOT NULL,";
$user_table_def .= "useremail VARCHAR(50) NOT NULL, ";
$user_table_def .= "userprofile TEXT NOT NULL,";
$user_table_def .= "PRIMARY KEY (userid),";
$user_table_def .= "UNIQUE usernumber (usernumber)";

$access_log_tablename = "access_log";
$access_log_table_def = "page VARCHAR(250) NOT NULL,";
$access_log_table_def .= "userid VARCHAR(8) BINARY NOT NULL,";
$access_log_table_def .= "visitcount MEDIUMINT(5) DEFAULT '0' NOT NULL,";
$access_log_table_def .= "accessdate TIMESTAMP(14),KEY page (page),";
$access_log_table_def .= "PRIMARY KEY (userid, page)";
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Connect to the server with the following:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$link_id = db_connect();
if(!$link_id) die(sql_error());
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Create the sample_db database:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if(!mysql_query("CREATE DATABASE $dbname")) die(sql_error());
echo "Successfully created the $dbname database.&amp;lt;BR&amp;gt;";
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;And then select it with mysql_select_db():&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if(!mysql_select_db($dbname)) die(sql_error());
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Subsequent calls to &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_query()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; create  the user and access_log tables. If an error occurs during a query, the error  number and text are displayed by calling the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;sql_error()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if(!mysql_query("CREATE TABLE $user_tablename ($user_table_def)"))
                                                           die(sql_error());

if(!mysql_query("CREATE TABLE $access_log_tablename ($access_log_table_def)"))
                                                           die(sql_error());
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you make it through to the end of the script, you confirm a  successful run:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;echo "Successfully created tables $user_tablename and $access_log_tablename.";
?&amp;gt;
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="965"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Recall that the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;sql_error()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function  calls the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_errno()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_error()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; functions if the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERRNO&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; variable is empty:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if(empty($MYSQL_ERRNO)) {
    $MYSQL_ERRNO = mysql_errno();
    $MYSQL_ERROR = mysql_error();
}
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This ensures that the function returns the error number and  text even when a database connection is successful but a subsequent query  fails.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="966"&gt;&lt;/a&gt;Altering Tables&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;So you've created a database, and populated it with  carefully constructed tables. You've used it for a while and not had too much  trouble—it's not perfect, but it does the job. Then out of the blue, you realize  one day that your little database isn't all it's cracked up to be. You've caught  on to the fact that your tables are badly designed. You've found some new data  that doesn't quite fit the format you expected. Any number of things can make  you sit up and realize that you need to modify the tables in your database.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MySQL provides the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;ALTER TABLE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command to  do just that. With this command you can:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Add and delete fields or indexes (&lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;ADD&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DROP&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;).&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Change the definition of existing fields (&lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;ALTER&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;CHANGE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MODIFY&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;).&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Rename fields (&lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;CHANGE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;) or even the  table itself (&lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;RENAME AS&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;).&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;For example, if you wanted to change the name of the table test to  tested, you could issue the following command:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; ALTER TABLE test RENAME AS tested;
Query OK, 0 rows affected (0.02 sec)
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; keyword is optional—this works  just as well:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; ALTER TABLE test RENAME tested;
Query OK, 0 rows affected (0.02 sec)
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Let's add a new &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;ENUM&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; field to the user  table. Call it sex; it can be used to indicate whether a user is male or  female:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; ALTER TABLE user ADD sex ENUM('M', 'F') DEFAULT 'M';
Query OK, 0 rows affected (0.24 sec)
Records: 0  Duplicates: 0 Warnings: 0

mysql&amp;gt; DESC user;
+----------------+---------------+------+-----+--------+----------------+
| Field          | Type          | Null | Key | Default| Extra          |
+----------------+---------------+------+-----+--------+----------------+
| ...            |               |      |     |        |                |
| sex            | enum('M','F') | YES  |     |  M     |                |
+----------------+---------------+------+-----+--------+----------------+
10 rows in set (0.00 sec)
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="967"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The new field is added as the last field in the table. You can  insert a new field in the middle of a table by means of the keyword &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;AFTER&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;. Now drop the field so that you can insert it  again:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; ALTER TABLE user DROP sex;
Query OK, 0 rows affected (0.08 sec)
Records: 0  Duplicates: 0 Warnings: 0
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;To place the new sex field right after the username field, you  could say:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; ALTER TABLE user ADD sex ENUM('M', 'F') DEFAULT 'M' AFTER username;
Query OK, 0 rows affected (0.09 sec)
Records: 0  Duplicates: 0 Warnings: 0

mysql&amp;gt; desc user;
+----------------+--------------------+------+-----+------------+----------+
| Field          | Type               | Null | Key | Default    | Extra    |
+----------------+--------------------+------+-----+------------+----------+
|...             |                    |      |     |            |          |
| sex            | enum('M','F')      | YES  |     |  M         |          |
+----------------+--------------------+------+-----+------------+----------+
10 rows in set (0.00 sec)
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;To place a new field at the start of the field list, you'd use the  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;FIRST&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; keyword instead, because there would be no  preceding field.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you're running a site aimed at female visitors, you'd probably  want the default value of the sex field changed from &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;M&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  to &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;F&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; ALTER TABLE user ALTER sex SET DEFAULT 'F';
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0 Warnings: 0
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; white-space: normal;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;To change the whole definition of a field, use the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MODIFY&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; keyword:&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; ALTER TABLE user MODIFY userprofile VARCHAR(250) NOT NULL
    -&amp;gt; DEFAULT 'No Comment';
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0 Warnings: 0
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;To change the field's name and its definition, you can use the  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;CHANGE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; keyword:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; ALTER TABLE user CHANGE userposition playerposition
VARCHAR(50) NOT NULL;
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0 Warnings: 0
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Adding or dropping indexes or primary keys is just as easy:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; ALTER TABLE user ADD INDEX (username);
Query OK, 0 rows affected (0.08 sec)
Records: 0  Duplicates: 0 Warnings: 0
mysql&amp;gt; ALTER TABLE user DROP INDEX username;
Query OK, 0 rows affected (0.09 sec)
Records: 0  Duplicates: 0 Warnings: 0
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="968"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Experiment a little with the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;ALTER TABLE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  command, and you'll soon master it. As an exercise, change back the structure of  the user table.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Altering table structures in PHP is as simple as issuing any other  query using the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_query()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function. Assuming you're  connected to the sample_db database, the following line is all it takes to drop  the index &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;registerdate&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_query("ALTER TABLE user DROP INDEX registerdate");
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="969"&gt;&lt;/a&gt;Inserting Data into a Table&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It's time to insert some data into the tables you created.  (You'll see how to insert data using PHP in the &lt;/span&gt;&lt;a class="chapterjump" href="http://www.blogger.com/post-create.g?blogID=995644850464800479" target="_parent"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;next chapter&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, where it's dealt with  in great detail.)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Unsurprisingly, you use the SQL command INSERT to insert new  records into a table. Try this:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; INSERT INTO access_log VALUES('/score.html', 'Pads', 2, NULL);
Query OK, 1 row affected (0.00 sec)

mysql&amp;gt; SELECT * FROM access_log WHERE userid = 'Pads';
+-------------+--------+------------+----------------+
| page        | userid | visitcount | accessdate     |
+-------------+--------+------------+----------------+
|/score.html  | Pads   |          2 | 20040804153559 |
+----------------------------------------------------+
1 row in set (0.00 sec)
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you're inserting a string value, you have to specify it in  quotes.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you wanted to carry on using this syntax, you'd need to specify  all the values to be inserted into every corresponding field in a table. You  give &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; as a value for the accessdate field, which is  of type &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;TIMESTAMP&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; so that it saves the current system  time in the format YYYYMMDDhhmmss. You provide a &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  or &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;0&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; value to an &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;integer&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; type  field with an &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;AUTO_INCREMENT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; attribute.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you want to insert values into only a subset of the fields in a  table, you use a slightly different syntax:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; INSERT INTO access_log (page, userid, visitcount)
    -&amp;gt; VALUES('/stats.html', 'Pads', 1);
Query OK, 1 row affected (0.00 sec)
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Assuming this query is successful, the specified fields are given  the values listed, whereas the rest are assigned default values. For example,  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;accessdate&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; is a timestamp field, so its default is the  current system time—just what you want:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; SELECT * FROM access_log WHERE userid = 'Pads';
+-------------+--------+------------+----------------+
| page        | userid | visitcount | accessdate     |
+-------------+--------+------------+----------------+
|/score.html  | Pads   |          2 | 20040804153559 |
|/stats.html  | Pads   |          1 | 20040804152382 |
+-------------+--------+------------+----------------+
1 row in set (0.00 sec)
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="970"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="971"&gt;&lt;/a&gt;Escaping Quotes&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;When you insert a string value into a character or text type  fields, make sure no unescaped single quotes are inserted, otherwise you're  bound to see an error:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; INSERT INTO user (userproflie)
    -&amp;gt; VALUES('I'm a rugby player.');
    '&amp;gt;
    '&amp;gt;
    '&amp;gt; ';
ERROR 1064: You have an error in your SQL syntax near 'm a PHP developer.');
 at line 1
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Even if you issue the query terminating it with a semicolon, the  mysql client insists on getting more of it because the MySQL server expects  another single quote to pair off the last one. That's why there's a quote mark  before the prompt. When you supply one more single quote to satisfy the server's  expectation, it generates an error. The solution? You can either escape the  inside single quote:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; INSERT INTO user (userprofile) VALUES('I\'m a rugby player.');
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Or use double quotes to surround the string value:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; INSERT INTO user (userprofile) VALUES("I'm a rugby player.");
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Remember that a backslash (which is used to denote a directory in  a path on the DOS/Windows platform, for example) also needs to be escaped. In  this case, use a double backslash:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; INSERT INTO user (userprofile) VALUES("C:\\Program Files\\PHP");
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you try to insert a new record that contains the same value for  a primary or unique key of an existing record, an error occurs:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; INSERT INTO user (userid, userprofile)
    -&amp;gt; VALUES('Pads', 'I\'m a rugby player.');
ERROR 1062: Duplicate entry 'Pads' for key 1
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The MySQL server complains that you are trying to insert a  duplicate record that contains the same value for a primary key, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;userid&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;. User Pads already exists in the table. Because the  userid field is defined as a primary key, no duplicate entries are allowed.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;However, you might want to insert a new record overwriting the  existing one. Say, for example, that you inserted wrong values for a user record  and rather than deleting the record and inserting it again, you want to replace  it with a new correct one. In this case, you'd use the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;REPLACE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command. The only difference between the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;INSERT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;REPLACE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; is this: if the  primary key for the new record duplicates an existing one, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;REPLACE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; overwrites the existing record, although &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;INSERT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; won't, as you've seen.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; REPLACE INTO user (userid, userprofile)
    -&amp;gt; VALUES('Pads', 'I\'m a rugby player.');
Query OK, 1 row affected (0.00 sec)
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="972"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="973"&gt;&lt;/a&gt;Populating the Database Tables&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Now you're all set to put some records into your tables. For  example, you can use the following &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;INSERT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command to  insert the record for the user Pads:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; INSERT INTO user VALUES(
    -&amp;gt; NULL,
    -&amp;gt; 'Pads',
    -&amp;gt; password('12345'),
    -&amp;gt; 'Brian Reid',
    -&amp;gt; 'Winger',
    -&amp;gt; 'Stickypads@doggiesrugby.co.za',
    -&amp;gt; 'A top class ball-handler.');
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Use the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;function password()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; to encrypt  the password &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;12345&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;. This is a MySQL server function  that you'll learn more about these in the &lt;/span&gt;&lt;a class="chapterjump" href="http://www.blogger.com/post-create.g?blogID=995644850464800479" target="_parent"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;next chapter&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Give a &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; value to the usernumber  field—you'll remember that because it's an &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;AUTO_INCREMENT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; field, this automatically adds one to the  number assigned to each new user.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Here's how I've populated the user table. Please note that a  password field isn't included because the values saved by mysql will be  encrypted anyway. You should insert whatever values you want for the password  field for each user:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informaltable"&gt; &lt;table border="1"&gt;&lt;thead&gt;
&lt;tr valign="top"&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;user number&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;User&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;User name&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;User position&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;User email&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;User profile&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt; &lt;tbody&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;1&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Pads&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Brian Reid&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Winger&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;a class="url" href="mailto:Stickypads@doggiesrugby.co.za"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Stickypads@doggiesrugby.co.za&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;A top class ball-handler&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;2&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nicrot&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nic Malan&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Mid&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;a class="url" href="mailto:therot@mywebsiteaddress"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;therot@mywebsiteaddress&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;.com&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Can't stop the rot&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;3&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Spargy&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Andrew Sparg&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Mid&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;a class="url" href="mailto:Spargy@whatyoumaycallit.com"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Spargy@whatyoumaycallit.com&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Never gets the ball from Dodge&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;4&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Dodge&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Dave&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Mercer&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Link&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;a class="url" href="mailto:davidm@contechst.com"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;davidm@contechst.com&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The admirals!&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;5&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Mac&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Murray McCcallum&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Winger&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;a class="url" href="mailto:murray@doggiesrugby.co.za"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;murray@doggiesrugby.co.za&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;That is not my number&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;6&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Greeny&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Mark Greenfield&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Utility back&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;a class="url" href="mailto:greeny@greenyweb.co.za"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;greeny@greenyweb.co.za&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Would never drop the ball over the  line&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="974"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The following command inserts an access log record for user Greeny  in the access_log table:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; INSERT INTO access_log VALUES(
    -&amp;gt; '/penalties/index.html',
    -&amp;gt; 'Greeny',
    -&amp;gt; 9,
    -&amp;gt; '20040321123155');
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Again, the accessdate field would normally be assigned a &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; value. The access_log table need only contain a few  dummy records for use in the upcoming examples. It will be populated  automatically toward the end of the database chapters by the application you  build, which uses your table to log the number of accesses made on your  fictional Web site.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Congratulations! You now have a database, populated and ready  for use!&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-7184051275332738021?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/7184051275332738021?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/7184051275332738021?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2011/01/creating-databases-and-tables-from.html" title="Creating Databases and Tables From MySQL" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;DkcCQX07fCp7ImA9Wx9QGUU.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-872442060952096830</id><published>2011-01-03T00:01:00.009+08:00</published><updated>2011-01-03T00:01:00.304+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-03T00:01:00.304+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="php mysql connectivity" /><title>PHP MySQL Connectivity</title><content type="html">&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;To work with a MySQL server (or any other RDBMS) in PHP, you  must follow these steps:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ol class="orderedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Open a connection to the server.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Work with databases in the server.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Close the connection.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Does this list sound familiar? You followed similar steps when  working with files and directories in the preceding chapter. No big deal!&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="941"&gt;&lt;/a&gt;Basic Connection Functions&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Let's begin this section by exploring some basic PHP  functions you can use to work with MySQL:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_connect()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: Creates a  connection to a MySQL server. It takes three string arguments: the hostname; the  database username, and the database user password. The function returns a link  identifier when it successfully connects to the specified MySQL server (or &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; upon error):&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$link_id = mysql_connect("localhost", "phpuser", "phppass");
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The link identifier works much the same as a file or directory  handle. You'll use it later to issue queries. All of the arguments are optional,  and when none are provided, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;"localhost",&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; the Web server  owner's username, and an empty password are all assumed.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysqlclose()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: The link to the MySQL  server is closed when the script is terminated. If you want to close the  connection earlier, use this function, with the link identifier as its  argument:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_close($link_id);
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The function returns &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;true&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; on success and  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; upon error. If the link identifier is omitted,  the previously opened link is used (if not specified otherwise, all &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_*&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; functions which take an optional link ID argument  assume the previously opened link in its absence).&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_list_dbs()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: PHP's equivalent  to MySQL's &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SHOW DATABASES&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command. Its only argument is  the (optional) link identifier. It returns a pointer (&lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result  below&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;) to the array containing the names of available databases:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result = mysql_list_dbs($link_id);
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="942"&gt;&lt;/a&gt; &lt;/span&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_select_db()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: Used to select a  database, returning &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;True&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; on success and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;False&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; upon error. It takes the name of the database as an  argument, although a link identifier argument is optional. Here's an  example:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_select_db("mysql", $link_id);
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If no connection has been made before calling this function, it  attempts to establish a link before selecting the specified database. Let's take  a moment to illustrate how you can connect to the local MySQL server with the  account you created earlier, using PHP:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$link_id = mysql_connect("localhost" "phpuser", "phppass");
if(mysql_select_db("mysql", $link_id)) echo "Connected to the localhost.";
else die ("Connection failed.");
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This code establishes a connection to the local MySQL server, and  selects the mysql access privilege database. If the connection fails, an error  message is displayed.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_list_tables()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: Equivalent to  MySQL's &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SHOW TABLES&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command. The database name and the  optional link identifier are taken as arguments. A pointer is returned to the  array containing the names of available tables associated with the database:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result = mysql_list_tables("mysql", $link_id);
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_num_rows()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: Use to find the  number of rows in a result set returned by a given query. It takes the result  set pointer as an argument:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$num_rows = mysql_num_rows($result);
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Use it on result sets returned by &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  queries, and other functions that retrieve rows.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_affected_rows()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: Use instead  of &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_num_rows()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; to get the number of rows affected  by &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;INSERT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UPDATE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, or &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DELETE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; commands. It takes an optional link ID argument:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$num_rows = mysql_affected_rows($link_id);
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote class="blockquote"&gt; &lt;div class="first-para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;A &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DELETE&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;query with no &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;WHERE&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;clause wipes  out all the records in a given table and causes the &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_affected_rows()&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;function call to  return zero.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The return value of &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_num_rows()&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;and &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_affected_rows()&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;is the actual  count of rows selected/affected. The return value from &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_list_dbs()&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;and &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysq_list_tables()&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;is a pointer to a  result set.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_fetch_row()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: Use to retrieve the  rows of records returned from the server. It takes a result set pointer returned  from a previous query, and returns an array corresponding to the fetched row (or  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;False&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; if there are no more rows left):&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$fetched_row = mysql_fetch_row($result_set);
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="943"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;PHP maintains an internal pointer to the row returned from a  previous query. Each subsequent call to this function moves the pointer to the  next row available. When the pointer moves past the result set array boundary,  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_fetch_row()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; returns &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;False&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;For a comprehensive list of MySQL functions, please see &lt;/span&gt;&lt;a class="chapterjump" href="http://www.blogger.com/post-create.g?blogID=995644850464800479" target="_parent"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Appendix B&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="example"&gt;&lt;span class="example-title"&gt;&lt;span class="example-titlelabel"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Try  it Out: &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Connect to a MySQL Server in PHP&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="944"&gt;&lt;/a&gt;  &lt;/span&gt;&lt;div class="formalbody"&gt; &lt;table border="0" cellpadding="0" cellspacing="0" class="BlueLine"&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td bgcolor="#000080" class="bluecell"&gt;&lt;span style="color: #010100; font-size: x-small;"&gt;&lt;b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;img alt="Start example" border="0" height="2" src="" width="1" /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Here's a sample script, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;db_disconnect.php&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, which uses the functions already  introduced to list the databases and tables available to the MySQL user  phpuser:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$link_id = mysql_connect("localhost", "phpuser", "phppass");&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result = mysql_list_dbs($link_id);&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;while($db_data = mysql_fetch_row($result)) {&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
        &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;echo $db_data[0] . "&amp;lt;BR&amp;gt;";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
        &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result2 = mysql_list_tables($db_data[0]);&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
        &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$num_rows = = mysql_num_rows($result2);&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
        &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;while($table_data =mysql_fetch_row($result2)) {&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
           &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;echo"--" . $table_data[0]. "&amp;lt;BR&amp;gt;";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
         &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
        &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;echo "==&amp;gt; $num_rows table(s) in " . $db_data[0] . "&amp;lt;P&amp;gt;";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This script lists all databases available and tables in each of  them. Here's a sample run:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql
--columns_priv
--db
--func
--host
--tables_priv
--user
==&amp;gt; 6 table(s) in mysql
test_db
--sample_table1
--sample_table2
==&amp;gt; 2 table(s) in test_db
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Hang on, though! If you've been following along with the SQL  commands, you probably got an error. If you did, go back to the section on GRANT  and REVOKE, and grant phpuser enough privileges to be able to look at the tables  in the databases, and then run the script again.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Alternatively, you can follow  along and view the error-handling section after this example.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="BlueLine"&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td bgcolor="#000080" class="bluecell"&gt;&lt;span style="color: #010100; font-size: x-small;"&gt;&lt;b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;img alt="End example" border="0" height="2" src="" width="1" /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="BlankSpace"&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td height="16"&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="945"&gt;&lt;/a&gt;How it Works&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The script first makes a connection to the server with the  given set of values: &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;localhost&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;phpuser&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;phppass&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;. Replace the  values here with the appropriate ones for you, if you want to use your own  username and password instead of those you gave to the user you created  earlier.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="946"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The link identifier returned by the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_connect()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function is used by the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_list_dbs()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function call. In fact, you don't need to  pass the link identifier to the latter function because &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_list_dbs()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; would assume the last opened link in the  absence of a link argument, like so:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result = mysql_list_dbs();
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;A common mistake is overwriting the result pointer when you issue  another query while stepping through the result set returned from a previous  query. Just as you can open multiple files with different file handles, you  should maintain multiple result sets by assigning unique pointers to each  set.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;In this example, a while loop in the script cycles through the  result set returned by the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_list_dbs()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function  call. Another while loop is set up to look into every element in the result set  returned by the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_list_tables()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function call. Both  loops are terminated when there are no more rows left in the result sets because  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$db_data&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$table_data&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; are  False when the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_fetch_row()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function is done  fetching the returned rows.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;while($db_data = mysql_fetch_row($result)) {
        echo $db_data[0]. "&amp;lt;BR&amp;gt;";
        $result2 = mysql_list_tables($db_data[0]);
        $num_rows = mysql_num_rows($result2);
        while($table_data = mysql_fetch_row($result2)) {
          echo "--" . $table_data[0]. "&amp;lt;BR&amp;gt;";
        }
        echo ==&amp;gt; $num_rows table(s) in " . $db_data[0] . "&amp;lt;P&amp;gt;";
}
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Each of the arrays returned by &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_list_dbs()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_list_tables()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; contains only one element; the name of a  database &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$db_data [0]&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and the name of a table &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$table_data[0]&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, respectively. If you want to retrieve more  than one field from a table, you can refer to each one by a corresponding array  index:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$result_set = mysql_fetch_row($result);
$first_column = $result_set[0];
$second_column = $result_set[1];
$third_column = $result_set[2];
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You haven't used the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_close()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  function, but it's seldom used in real-life applications unless you need to  close the connection for some reason before your applications end. PHP  automatically closes the open connection before your script ends.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You learn more about how MySQL and PHP can work in tandem in  the following chapters.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="947"&gt;&lt;/a&gt;Handling Server Errors&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Now let's try something rather dumb: take the last script,  change the database username to no_such_user, and see what happens. Unless  you've set the error reporting level in the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;php.ini&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  configuration file to suppress them, a bunch of warnings are thrown out:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Warning: MySQL Connection Failed: Access denied for user: 'no_such_user@local
host' (Using password: YES) in /home/apache/htdocs/db_connect.php on line 3&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="948"&gt;&lt;/a&gt;
Warning: Supplied argument is not a valid MySQL-Link resource in /home/apache/
htdocs/db_connect.php on line 5

Warning: Supplied argument is not a valid MySQL result resource in /home/
apache/htdocs/db_connect.php on line 6

Warning: Supplied argument is not a valid MySQL result resource in /home/
apache/htdocs/db_connect.php on line 8
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Why do you get such uninformative warnings? It's simple—the script  you just created isn't smart enough to say what went wrong upon error; it just  knows that it tried to access some MySQL resources but failed. PHP is generating  the warnings, but the errors are on the database server.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;PHP provides a couple of functions that catch server errors and  determine what went wrong, returning values from the server's own error-handler.  If a MySQL server encounters an error while executing a specified task, it  returns the text and number of the error message. You can get at these values  using the PHP functions &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_errno()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_error()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_errno()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function returns the  error number and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_error()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; returns the error text  from the previous MySQL operation. They both take an optional link identifier  argument (defaulting to the previously-opened link):&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif; white-space: pre;"&gt;$MYSQL_ERRNO = mysql_errno($link_id);&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERROR = mysql_error($link_id);
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;These functions assume the connection to the server has already  been made, so if you call them to see why a connection has failed, no error is  reported because no opened link is available. As you've seen, though, you can  still use the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;die()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function to exit with a message  that the connection attempt has failed:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if(!mysql_connect("localhost", "no_such_user", "phppass"))
                                                   die("Connection failed!");
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The only problem with this approach is that PHP still churns out  its own warning messages when the connection attempt fails. To prevent warnings  and/or error messages, either precede the function call with the error message  suppressing operator &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;@&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, or use the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;error_reporting()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You can use the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;error_reporting()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  function call to set the level of error reporting that PHP applies while  executing subsequent code. By specifying &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;error_reporting  (0)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, you can ensure that no PHP error/warning messages will be invoked.  This is what you do in the following example.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;blockquote class="blockquote"&gt; &lt;div class="first-para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It's not a good idea to set the level to  produce warnings in production environment because they might scare away your  users. Set it to a higher level only when you are debugging your  applications.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="example"&gt;&lt;span class="example-title"&gt;&lt;span class="example-titlelabel"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Try  it Out: &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Handle Server Errors&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="949"&gt;&lt;/a&gt;  &lt;/span&gt;&lt;div class="formalbody"&gt; &lt;table border="0" cellpadding="0" cellspacing="0" class="BlueLine"&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td bgcolor="#000080" class="bluecell"&gt;&lt;span style="color: #010100; font-size: x-small;"&gt;&lt;b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;img alt="Start example" border="0" height="2" src="" width="1" /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;We're going to define a couple of functions that you'll find  very useful in later sections. Create a new file called &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;common_db.inc&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and enter the following code:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="950"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;lt;?pbp&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$dbhost = 'localhost';&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$dbusername = 'phpuser';&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$dbuserpassword = 'phppass';&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$default_dbname = 'mysql';&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ ERRNO = '';&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERROR = '';&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;function db_Connect(){&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;global $dbhost. $dbusername, $dbuserpassword, $default_dbname;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;global, $MYSQL_ ERRNO, $MYSQL_ERROR;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$link_id = mysql_connect($dbhost, $dbusername, $dbuserpassword);&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if(!$link_id) {&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
      &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERRNO = 0;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
      &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERROR = "Connection failed to the host $dbhost.";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
      &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;return 0;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;else if(empty($dbname) &amp;amp;&amp;amp; !mysql_select_db($default_dbname)) {&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
      &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERRNO = mysql_errno();&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
      &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERROR = mysql_error();&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
      &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;return 0;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;else return $linx_id;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;function sql_error() {&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;global. $MYSQL_ERRORNO, $MYSQL_ERROR;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;

   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if (empty ($MYSQL_ERROR)) {&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
       &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERRNO = mysql_errno();&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
       &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERROR = mysql_error();&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;return "$MYSQL_ERRNO: $MYSQL_ERROR";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You can include this file in later examples, and expand it as  necessary. Note the function &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;db_connect()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, which is  dedicated to making connections to the MySQL server. You'll use it a lot!&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You should be aware that this file contains some pretty important  information that you don't want to fall into the hands of unethical users. It's  generally suggested that files containing plain-text passwords be stored outside  of your Web tree for security purposes. PHP can still access them there, and  this prevents o user from getting at the file in a non programmatic way,, such  as tricking the server into offering up the page as plain text. The file has to  be executed, which would prevent the password from being displayed.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Now try the following script, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;db_connect.php&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, with an incorrect username/password  combination oz nonexistent database names:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;include "common_db.inc";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;error_reporting(0);&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="951"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$link_id = db_connect();&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if(!$link_id) die(sql_error());&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;else echo "Successfully made a connection to $dbhost.&amp;lt;BR&amp;gt;";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Try the script using an invalid username or password, and you  should see the following error message:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;0: Connection failed to the host localhost.
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If $default_dbname is empty, you get:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;1046: No Database Selected
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If it's set to a nonexistent database name (no_such_db for  example), you see:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;1049: Unknown database 'no_such_db'
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="BlueLine"&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td bgcolor="#000080" class="bluecell"&gt;&lt;span style="color: #010100; font-size: x-small;"&gt;&lt;b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;img alt="End example" border="0" height="2" src="" width="1" /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="BlankSpace"&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td height="16"&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="952"&gt;&lt;/a&gt;How it Works&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Once you've included these variable and function  definitions, you specify &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;error_reporting(0)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; to prevent  PHP from displaying any error/warning messages.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;blockquote class="blockquote"&gt; &lt;div class="first-para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You also could have suppressed error  messages by prefixing the following &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_connect()&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;and &lt;/span&gt;&lt;/i&gt;&lt;i class="emphasis"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_select_db()&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;function calls with an @ symbol.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If the database connection is made successfully, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;db_connect()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; returns a link identifier. Otherwise, it sets  global variables &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERRNO&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERROR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; accordingly, and returns zero to indicate an  error. Consequently, the script dies:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if(!$link_id) die(sql_error());
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Rather than directly specifying an error message, you've called  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;sql_error()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; to produce one for you:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;function sql_error() {
   global $MYSQL_ERRNO, $MYSQL_ERROR;

   if(empty($MYSQL_ERROR)) {
      $MYSQL_ERRNO = mysql_errno();
      $MYSQL_ERROR = mysql_error();
   }
   return "$MYSQL_ERRNO: $MYSQL_ERROR";
}
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Basically all this function does is return a character string  containing the error number and error message, separated by a colon, but it will  be quite useful to you in situations where you can't assume that the returned  variables have been defined. For example, you might want to call &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;sql_error()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; following a database query error; the trouble is  that &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERRNO&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERROR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; would not have been defined. To make this  function useful in such an event (as well as the failed connection you're  anticipating), check the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERROR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; global variable's  value. If it's empty, call &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_errno()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql_error()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; again and assign values to both.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="953"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;After a successful connection, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;db_connect()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; attempts to select the default database, which  you've set in the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$default_dbname&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; global variable. You  can improve &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;db_connect()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; by having it take an optional  argument &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$dbname&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, so that it selects whichever database  is specified in the argument:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;function db_connect($dbname='') {&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
   global $dbhost, $dbusername, $dbuserpassword, $default_dbname;
   global $MYSQL_ERRNO, $MYSQL_ERROR;

   $link_id = mysql_connect($dbhost, $dbusername, $dbuserpassword);
   if(!$link_id)    {
      $MYSQL_ERRNO = 0;
      $MYSQL_ERROR = "Connection failed to the host $dbhost.";
      return 0;
    }
    else if(empty($dbname) &amp;amp;&amp;amp; !mysql_select_db($default_dbname)) {
       $MYSQL_ERRNO = mysql_errno();
       $MYSQL_ERROR = mysql_error();
       return 0;
    }
    &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;else if(!empty($dbname) &amp;amp;&amp;amp; !mysql_select_db($dbname)) {&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
       &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERRNO = mysql_errno();&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
       &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$MYSQL_ERROR = mysql_error();&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
       &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;return 0;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
    &lt;/span&gt;&lt;span style="background-color: #d9d9d9;"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
    else return $link_id;
}
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You can now call it like this:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$link_id = db_connect("sample_db");
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The connection held by &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$link_id&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; will  automatically use the database sample.db. If you don't specify an argument,  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;db_connect()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; defaults to the database specified by  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;$default_dbname&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-872442060952096830?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/872442060952096830?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/872442060952096830?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2011/01/php-mysql-connectivity.html" title="PHP MySQL Connectivity" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;A0UCQXkzeyp7ImA9Wx9QE0o.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-1329612961351520261</id><published>2010-12-27T00:01:00.003+08:00</published><updated>2010-12-27T00:01:00.783+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-27T00:01:00.783+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="connecting mysql from php" /><title>Connecting to MySQL From PHP</title><content type="html">&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Okay, let's get back to PHP, and look at how you can tap  into all this database power from your dynamic Web pages.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;blockquote class="blockquote"&gt; &lt;div class="first-para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you're feeling a little overwhelmed  after going through all those SQL statements, don't worry! It's not essential  that you understand every last detail at this stage. You just want to get an  overall feel for how you go about interacting with a relational database such as  MySQL. You'll become a lot more familiar with the specifics as you move on and  start building applications for yourself.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Just as you used client programs to access the MySQL database  server from the command line, PHP needs some client code of its own to talk to  MySQL.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;In the days of PHP4, this was a no-brainer because the necessary  code was integrated right into the depths of PHP itself. Unfortunately that's no  longer the case, and PHP5 expects the MySQL client libraries to be present on  your system before compiling with PHP support. This is quite easy for Linux  users: just ensure that you compile PHP5 using the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-with-mysql&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; option.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;For Windows users, it's a little more complex. You need to:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ol class="orderedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Ensure that the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;libmysql.dll&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  library is in your system root path (libmysqli for versions of MySQL 4.1 and  later).&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Uncomment the mysql extension in the extensions section of  your &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;php.ini&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; file.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="939"&gt;&lt;/a&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Ensure that your &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;php_mysql.dll&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  extension is in a folder where PHP can find it. (This is set in the extension  directory setting in the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;php.ini&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; file.)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Restart your Web server after you've implemented these  changes.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;That's it! Nothing too complicated—it's just like using any  other extension in PHP. With everything set up, let's look at what you need to  do to get PHP5 and MySQL talking to each other.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-1329612961351520261?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/1329612961351520261?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/1329612961351520261?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2010/12/connecting-to-mysql-from-php.html" title="Connecting to MySQL From PHP" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;DkMCQX84cCp7ImA9Wx9RF0o.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-3300617406208864207</id><published>2010-12-20T00:01:00.006+08:00</published><updated>2010-12-20T00:01:00.138+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-20T00:01:00.138+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="sample mysql queries" /><title>A Quick Play with MySQL</title><content type="html">&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You'll start working with the MySQL server using the client  program mysql and a few simple database queries. Along the way, you'll play with  some database settings, create some new users (without quite as much access to  everything as the root user has), and get a taste of how queries work in  practice.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="923"&gt;&lt;/a&gt;Starting the mysql Client Program&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Fire up the mysql client by issuing the following command at  your command prompt:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt; mysql -uUSER -pPASSWORD -hHOST
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Replace the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;USER&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;PASSWORD&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;HOST&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; arguments to  reflect your personal settings. For example, if your database username and  password are phpuser and phppass and you're connecting to the host  db.whatever.com, the command would look like this:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt; mysql -uphpuser -pphppass -hdb.whatever.com
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="924"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;All the arguments are optional. If missing, the following values  are assumed for them:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informaltable"&gt; &lt;table border="1"&gt;&lt;thead&gt;
&lt;tr valign="top"&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Argument&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Value&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt; &lt;tbody&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-u&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Your shell account username&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-P&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;No password&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;-h&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;localhost&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The mysql client now connects to the database server running on  the specified &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;HOST&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; with the given user ID/password  combination. You may also specify a database to use by providing its name at the  end of the command, like this:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt; mysql -uUSER -pPASSWORD test
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You should see a response similar to the following:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Welcome to the MySQL monitor.  Commands end with; or \ g.
Your MySQL connection id is 4 to server version: 4.0.18-nt

Type 'help;' or '\ h' for help. Type '\ c' to clear the buffer.

mysql&amp;gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If the mysql client complains that it can't connect to the  specified server, check to see if the provided arguments are correct.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="925"&gt;&lt;/a&gt;Selecting a Database to Use&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;To see the list of databases available, use the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SHOW DATABASES&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; SHOW DATABASES;
+---------------+
| Database      |
+---------------+
| mysql         |
| test          |
+---------------+
2 rows in set (0.00 sec)
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This is mostly the same information you got from &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysqlshow&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; earlier: there are still two databases, mysql and  test, available in the system. This time, though, you're also told how many rows  were returned (2) and how long it took the server to execute the query (0.00  seconds to two decimal places).&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;In fact, you can use the mysql client to do just about anything  that the other, more specialized client programs can, as long as you know the  correct syntax. Let's dig a little deeper.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;To select a particular database, you can utilize the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;USE databasename&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; syntax. Let's have a poke around inside one  of the databases:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; USE mysql;
Database changed
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="926"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Your MySQL server is now ready to work with the database mysql. A  word to the wise: be careful how you use the user table; it contains important  information that you probably don't want to delete.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;blockquote class="blockquote"&gt; &lt;div class="first-para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;For the sake of readability, it is  recommended that SQL keywords are written in uppercase characters, and  user-defined names such as table and field names are lowercase. Remember that on  the Linux/UNIX platforms, arguments are case-sensitive: Mysql, MYSQL, and mysql  are all different database names.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="927"&gt;&lt;/a&gt;Looking at Tables Inside a Database&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You can use the SHOW TABLES command to list the existing  tables in the currently selected database:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; SHOW TABLES;
+-----------------+
| Tables in mysql |
+-----------------+
| columns_priv
| db              |
| func            |
| host            |
| tables_priv
| user            |
+-----------------+
6 rows in set (0.00 sec)
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Once again, a slight elaboration on the results you previously got  from &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysqlshow&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;. This time you can have a look at what's  going on inside the tables. For example, let's see how the user table is  structured. Use the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DESCRIBE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command, or &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DESC&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; for short:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; DESC user;
+--------------------+---------------------+------+-----+---------+-------+
| Field              | Type                | Null | Key | Default | Extra |
+--------------------+---------------------+------+-----+---------+-------+
| Host               | varchar(60) binary  |      | PRI |         |       |
| User               | varchar(16) binary  |      | PRI |         |       |
| password           | varchar(16)         |      |     |         |       |
| Select_priv        | enum('N','Y')       |      |     | N       |       |
| Insert_priv        | enum('N','Y')       |      |     | N       |       |
| Update_priv        | enum('N','Y')       |      |     | N       |       |
| Delete_priv        | enum('N','Y')       |      |     | N       |       |
| Create_priv        | enum('N','Y')       |      |     | N       |       |
| Drop_priv          | enum('N','Y')       |      |     | N       |       |
| Reload_priv        | enum('N','Y')       |      |     | N       |       |
| Shutdown_priv      | enum('N','Y')       |      |     | N       |       |
| Process_priv       | enum('N','Y')       |      |     | N       |       |
...
...
| File_priv          | enum('N','Y')       |      |     | N       |       |
| Grant_priv         | enum('N','Y')       |      |     | N       |       |
| References_priv    | enum('N','Y')       |      |     | N       |       |
| max_connections    | int(11) unsigned    |      |     | 0       |       |
+--------------------+---------------------+------+-----+---------+-------+
31 rows in set (0.00 sec)
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="928"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This command describes the user table's structure—what fields are  defined and how they've been configured. For example, you can see the Host field  can hold up to 60 characters and is defined as a primary key. The User field  also is defined as a primary key. That doesn't mean that the Host and User  fields are both primary keys (you should remember that this is forbidden).  Instead, the combination of the Host and User fields works as a sole primary key  in Host-User format.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;For example, if user john at localhost has been given the server  access privileges, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;localhost-john&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; becomes the primary  key value for his record. Another user at localhost whose name is also john  cannot be inserted as a record in this table. However, john at whatever.com  can.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;All the fields in the user table except the Host, User,  Password, are declared as &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;ENUM('N', 'Y')&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;. This means  that only one from the specified set of values (either N or Y in this case) can  be used in each field. Note that N is the default value when no value is  provided.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="929"&gt;&lt;/a&gt;Using SQL to Look at Data&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;All the queries you've given to the mysql client so far have  been specific to the MySQL database engine, and won't necessarily work with  another system, whether or not it supports SQL. Now that you're working down at  the level of actual data, though, it's time to use some bona fide SQL statements  to find out what's there.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Let's say you want to find out if there are any users registered  with access privileges from the local machine &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;localhost&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;. You might do this by issuing the following &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; query:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; SELECT User,Host FROM user;
+----------+-----------+
| User     | Host      +
+----------+-----------+
| root     |localhost  +
| dodge    |doggiesr   +
| james    |digistrawb +
+------------—---------+
3 rows in set (0.00 sec)
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Because there are only three rows, it's not hard to see that only  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;root&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; is currently registered as a local user. Of  course, it might be somewhat harder to spot this if you had a few hundred more  users registered in the database, so here's another way to get the same  result:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; SELECT User FROM user WHERE Host='localhost';
+----------+
| User     |
+----------+
| root     |
+----------+
1 row in set (0.00 sec)
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Using a &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;WHERE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; clause narrows the scope of  the retrieved records. This works much the same as PHP's &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; statement, except that the former uses a single equal sign  (=) whereas the latter uses two (==) to test for equality.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="930"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you wanted the server to retrieve all fields available instead  of a few specified ones, you could use the * wildcard. For example:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; SELECT * FROM tablename;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This command would retrieve all of the records from  tablename.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="931"&gt;&lt;/a&gt;Manipulating Data in a Database&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Now let's create a new database user, by &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;inserting&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; a new record into the user table using the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;INSERT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; INSERT INTO user VALUES(
    -&amp;gt; 'localhost',
    -&amp;gt; 'phpuser',
    -&amp;gt; Password('phppass'),
    -&amp;gt; 'N', 'N', 'N', 'N', 'N', 'N', 'N',
    -&amp;gt; 'N', 'N', 'N', 'N', 'N', 'N', 'N',
    -&amp;gt; 'N', 'N', 'N', 'N', 'N', 'N', 'N',
    -&amp;gt; 'N', 'N', 'N', 'N', 'N', 'N', 'N');
Query OK, 1 row affected (0.00 sec)
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;INSERT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; query creates a record for  the user phpuser, using the password phppass, in the user table, and specifies  no access privileges. Each string value is placed within single quotes—this  issue is discussed in greater detail later on. As you can see, the mysql client  reports that the query was successfully executed, and that one row of data has  been inserted as requested.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MySQL saves database user passwords after encrypting them. It uses  its own password encryption scheme (which is different than Linux's), so use  MySQL's built-in &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;password()&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; function to encrypt your  password.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;What if you change your mind and want to give user phpuser (who  presently has no access privileges at all) the server administration privileges  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Reload_priv&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Shutdown_priv&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;?  You could update the user table to reflect your whimsical decision using an  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UPDATE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; query, like this:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; UPDATE user SET Reload_priv='Y', Shutdown_priv='Y'
    -&amp;gt;  WHERE User='phpuser';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The mysql client reports that only one row matched the condition  set in the query and that it has been successfully updated. User phpuser now has  server administration privileges only: phpuser is only allowed to reload or shut  down the server.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;WHERE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; clause is optional, and when  omitted, the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UPDATE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; query changes all the records in a  given table with the new values provided. Warning: Make sure you don't change  records by accident. A nightmare can sometimes turn into reality if you're not  careful because a careless &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UPDATE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; query could, for  example, change 10,000 user records to have the same password. Even worse, all  the records in a table could unwittingly be deleted with a &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DELETE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; query such as:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; DELETE FROM test;
Query OK, 0 rows affected (0.00 sec)
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="932"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Here all of the records in the table test have been deleted. Don't  be fooled by the mysql client reporting that no row is affected by this query.  Following the query, the server has no way of knowing how many rows are affected  (deleted) because they're gone forever after the query. Note that the syntax of  this example &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DELETE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command contains no clauses.  Thankfully, you may specify which records are to be deleted with a WHERE  clause:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DELETE FROM tablename WHERE condition(s);
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Now you change you mind again and want to give user phpuser all of  the server administration privileges. What do you do? You can make either  another &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UPDATE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; query or you can &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;REPLACE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; the whole record. The syntax is pretty simple:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; REPLACE INTO user VALUES(
    -&amp;gt; 'localhost', 'phpuser', Password('phppass'),
    -&amp;gt; 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
    -&amp;gt; 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
    -&amp;gt; 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
    -&amp;gt; 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y');
Query OK, 1 row affected (0.00 sec)
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;So &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;REPLACE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; overwrites an old record with  a new one. Note that the new record and the old record must have the same value  in a field designated as a key (or the combined key formed by the Host and User  fields in this case). The difference between the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UPDATE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;REPLACE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; commands is that &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UPDATE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; replaces only the selected set of fields in a record,  whereas &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;REPLACE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; replaces the whole record with the  given values.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Finally, to activate the newly created account phpuser, you need  to flush privileges, reloading the privilege information from the table. (The  server normally reads the access privilege information only once, when it's  loaded.) First, exit mysql client, by typing &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;quit&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;,  (otherwise you'll get an error saying that your SQL syntax is incorrect).  Then:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt; mysqladmin -uUSER -pPASSWORD -hHOST flush-privileges
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Alternately you can issue the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;FLUSH  PRIVILEGES&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command to reflect the change in the mysql client program:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; FLUSH PRIVILEGES;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="933"&gt;&lt;/a&gt;Using GRANT and REVOKE Commands&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;GRANT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;REVOKE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; commands enable you to allocate and remove database  privileges as you choose. They can be used at various levels of your database  permissions structure, going from global to database to table to column  level—depending on how fine grain you want your control to be. Of course, for  whatever permissions you can grant a user, you can use a corresponding &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;REVOKE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; statement to remove them.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;In the following sections you'll see how to use these commands to  control permissions on your tables. For example, earlier you created a new user  by manipulating the user table directly. You can achieve the same goal more  simply using the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;GRANT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command. Let's see how.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="934"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="935"&gt;&lt;/a&gt;GRANT&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Here's the simplest form of the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;GRANT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; GRANT ALL PRIVILEGES ON *.* TO
    -&amp;gt; phpuser@localhost IDENTIFIED BY 'phppass';
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It gives every access privilege on every database in the system to  the user phpuser at localhost if he logs on to the server using the password  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;phppass&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;. Note that the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;user&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;host&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; arguments are &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;not&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; given  in quotes.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you want to let this user access the tables in the test  database only, you'd use the following command:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; GRANT ALL PRIVILEGES ON test.*
    -&amp;gt; TO phpuser@localhost IDENTIFIED BY 'phppass';
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Here, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;test.*&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; denotes all tables in the  test database. Similarly you can grant access to only the sample table in  test:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; GRANT ALL PRIVILEGES ON test.sample
    -&amp;gt; TO phpuser@localhost IDENTIFIED BY 'phppass';
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;By replacing the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;ALL PRIVILEGES&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; keyword  with a selection of query types, a set of access privileges can be granted:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; GRANT SELECT,INSERT,UPDATE ON test.*
    -&amp;gt; TO phpuser@% IDENTIFIED BY 'phppass';
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;With this command, the user phpuser can issue only &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;INSERT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UPDATE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; queries to any of the tables in the test database. Any  other query, such as &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DELETE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, won't be allowed.  Wildcards like * are extremely useful. For example, by replacing &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;localhost&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; with the % wild card, you can allow the user  phpuser to access the specified tables from any server.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You can also specify the host with a partial domain name: if you  used &lt;/span&gt;&lt;a class="url" href="mailto:phpuser@%.whatever.com"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;phpuser@%.whatever.com&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; for instance, only users with the  user ID phpuser connecting from the domain whatever.com would be granted access  to the server.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You can split hairs even further, by specifying the fields that  the user can access:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; GRANT SELECT (User, Host) ON mysql.user
    -&amp;gt; TO phpuser@localhost IDENTIFIED BY 'phppass';
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Here the user phpuser can issue only &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; queries on the User and Host fields in the user  table.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You can use the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;WITH GRANT OPTION&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; clause  to give the specified user the capability to grant other users any privileges he  has at the specified privilege level:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; GRANT ALL PRIVILEGES ON test.*
    -&amp;gt; TO phpuser@localhost IDENTIFIED BY 'phppass' WITH GRANT OPTION;
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="936"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This command is equivalent to creating another superuser,  called phpuser. Be careful with the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;WITH GRANT OPTION&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  clause: two users with different privileges can easily team up and extend their  privileges by exchanging them!&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="937"&gt;&lt;/a&gt;REVOKE&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;REVOKE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command removes access  privileges from a user. If you want to revoke &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;all&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  privileges given to user phpuser, for example, issue the following command:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; REVOKE ALL PRIVILEGES ON *.* FROM phpuser;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You can specify multiple usernames by separating them with  commas:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; REVOKE ALL PRIVILEGES ON *.*
     &amp;gt; FROM phpuser@localhost, phpuser2, phpuser3;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;All specified users must exist, and possess the specified  privileges, in order for this command to work.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The following command revokes only the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; privilege from the user phpuser:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; REVOKE SELECT ON *.* FROM phpuser@localhost;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Again, you can split hairs by specifying field names:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; REVOKE SELECT (User, Host) ON mysql.user FROM phpuser@localhost;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you modify the grant tables using &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;GRANT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; or &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;REVOKE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; commands, the  changes take effect immediately. You don't have to flush privileges or reload  the server.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-3300617406208864207?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/3300617406208864207?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/3300617406208864207?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2010/12/quick-play-with-mysql.html" title="A Quick Play with MySQL" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;A0ECQXg7fCp7ImA9Wx9REUs.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-2199522324308783644</id><published>2010-12-13T00:01:00.006+08:00</published><updated>2010-12-13T00:01:00.604+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-13T00:01:00.604+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="relational databases" /><title>Relational Databases</title><content type="html">&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;One key characteristic of databases that you haven't looked  at so far is how a database organizes data for users to interact with. Whenever  you use the database engine to retrieve, modify, or add new data, you need to  know what to ask for—moreover, when you come to design a database for yourself,  you need to tell the database engine what sort of data to expect where, and how  it's all meant to hang together.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Most of the databases you considered earlier use what's known as a  relational data model. As such, they're known as relational databases (or  Relational Database Management Systems—RDBMS). They arrange data into tables,  each of which is divided into rows and columns.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;In database parlance, each row in a table (apart from the heading)  represents a data &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;record:&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; a set of intrinsically connected  pieces of data. Likewise, each column represents a &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;field:&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  a specific type of data that has the same significance for each record in the  table.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;blockquote class="blockquote"&gt; &lt;div class="first-para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;For all practical purposes, the term row  is synonymous with record, whereas column is synonymous with field. This is  useful to bear in mind when visualizing tables.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Suppose that the manager of a touch-rugby team (don't worry if you  aren't familiar with touch rugby —the sport is incidental to the topic and won't  affect your understanding of databases in any way) sets up a database so that he  can track the matches in which his players compete. Naively, he asks each player  to enter his details into the database after each match. After the second round  of matches, the manager's &lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="902"&gt;&lt;/a&gt;table looks like this:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informaltable"&gt; &lt;table border="1"&gt;&lt;thead&gt;
&lt;tr valign="top"&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Player_Number&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Name&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Phone_number&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Date_Played&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nicknam&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;e&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt; &lt;tbody&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;42&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;David&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-1234&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;03/03/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Dodge&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;6&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nic&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-3456&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;03/03/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Obi-d&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;2&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;David&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-6543&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;03/03/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Witblitz&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;14&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Mark&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-1213&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;03/03/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Greeny&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;2&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;David&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-6543&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;02/25/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Witblitz&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;25&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Pads&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-9101&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;02/25/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Pads&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;6&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nic&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-3456&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;02/25/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Obi-d&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;7&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nic&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-5678&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;02/25/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nicrot&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;He soon realizes that this is going to make for a huge table after  everyone on the team has played an entire season's worth of games. As you can  see, the structure of the table is inefficient because each player's  details—number, name, phone number, and so on—are entered every time he plays a  match.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Such redundancy is undesirable in a database. For example, say  that the player with the number 6 keeps dropping the ball, and his teammates  decide to give him a new nickname (which won't be mentioned here). To update the  table, every one of this player's records would have to be modified to reflect  his new nickname.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;In addition, every time a player enters his details after a match,  all of that information is consuming valuable space on the hard drive.  Redundancy is terribly inefficient, wasting a great deal of time and space.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Fortunately, in the early 1970s, Dr. E. F. Codd came up with a  unique and powerful way to alleviate this type of problem. He stipulated a set  of rules that, when applied to data, ensure that your database is well designed.  In truth, he stipulated no small number of rules, but for most purposes you need  only concern yourself with the first few. These requirements can be divided up  into what are called &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;normal forms,&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and making sure your  data complies with these normal forms goes a long way to ensuring good  relational database design. Let's take a look at what normalization is all  about.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="903"&gt;&lt;/a&gt;Normalization&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Normalization is defined as "the process of breaking up the  data into several tables, so as to minimize the number of times you have to  repeat the same data." The normal forms are degrees of normalization, and they  are governed by an elegant set of rules that can be summarized as follows:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="904"&gt;&lt;/a&gt;First Normal Form (1NF)&lt;/span&gt;&lt;/h4&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Create a new table for each new set of related data you want  to store.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Eliminate repeating information in an individual table.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Uniquely identify each record with a primary  key.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="905"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;For example, in 1NF you could split the preceding table into a  player information table:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informaltable"&gt; &lt;table border="1"&gt;&lt;thead&gt;
&lt;tr valign="top"&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Player_Id&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Name&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Phone_number&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nickname&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt; &lt;tbody&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;42&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;David&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-1234&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Dodge&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;6&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nic&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-3456&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Obi-d&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;14&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Mark&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-1213&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Greeny&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;2&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;David&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-6543&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Witblitz&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;25&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Pads&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-9101&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Pads&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;6&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nic&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-3456&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Obi-d&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;7&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nic&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-5678&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nicrot&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;And match log table:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informaltable"&gt; &lt;table border="1"&gt;&lt;thead&gt;
&lt;tr valign="top"&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Player_Id&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="middle" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Date_Played&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt; &lt;tbody&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;42&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="middle" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;03/03/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;6&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="middle" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;03/03/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;2&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="middle" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;03/03/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;14&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="middle" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;03/03/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;2&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="middle" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;25/02/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;25&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="middle" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;25/02/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;6&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="middle" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;25/02/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;7&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="middle" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;25/02/04&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Notice how the original table splits naturally into these two new  tables. This is because the original table provided data about two distinct  things (or &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;entities&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;): players and matches. Each new table  contains data concerning just one entity. The split into entity tables is an  important part of the normalization process.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Now you can take another step toward conforming to the first  normal form: eliminating repeating information in an individual table. There's  some redundant information in the player information table that can be removed  to give you the following:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informaltable"&gt; &lt;table border="1"&gt;&lt;thead&gt;
&lt;tr valign="top"&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Player_Id&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Name&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Phone_number&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nickname&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt; &lt;tbody&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;42&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;David&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-1234&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Dodge&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;6&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nic&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-3456&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Obi-d&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;2&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;David&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555—6543&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Witblitz&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="906"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;14&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Mark&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-1213&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Greeny&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;25&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Pads&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-9101&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Pads&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;7&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nic&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;555-5678&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Nicrot&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Are you done with this table yet? There's no longer any duplicated  information, and the table represents only related information (information  about the player entities). But what about a unique identifier? Each entity must  have (at least) one unique field—in other words, a field in which no entries are  repeated. Because of the exclusive nature of this field, each entry in it  uniquely identifies (IDs) each record in the table. The field used to ID records  is often known as the &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;primary key.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; Only one primary key is  permitted per table.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;blockquote class="blockquote"&gt; &lt;div class="first-para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Remember, by moving the player information  to one table and the match log entries to another, you simplify the process of  modifying a player's details—you only have to modify one record in the player  table.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You could add a unique key, which would assign a unique number to  each record, but let's look at the information closely. In any given sport, a  player's number must be unique, so you know that all the values in the Player_Id  field are unique. But the Nickname field is also unique because each player can  only have one nickname at a time. Which one should you choose? You've already  seen that nicknames can change, based on performance, so the Player_Id field is  the sensible choice for a primary key.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;What about the match log table? Unfortunately, the Player_Id field  is no longer unique because each player plays on many dates. Obviously, the date  field can't be unique either, so you can't make a unique identifier out of  either field. In this case, you need to add one yourself (you'll learn how later  in the book). Once that's done, both tables are in first normal form. Adding an  ID field could have hidden uses, especially if you wanted to join the  information in the two fields of the match log table to create a unique key that  you could relate to some other data (the number of tries scored per player per  match, for example).&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The second normal form has two goals, which are applicable  only after you've achieved 1NF.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="907"&gt;&lt;/a&gt;Second Normal Form (2NF)&lt;/span&gt;&lt;/h4&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Create new tables for each new group of values that apply to  many records.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Relate new tables to existing tables with a &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;foreign key&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; (a key that identifies records in a different  table).&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Because both example tables contain a common field  (Player_Id), whose values correspond between tables, you have a way to &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;join&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; them together—you don't actually &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;need&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; a foreign key to accomplish this, but there are  definitely advantages to using foreign keys (For a more in-depth discussion on  them, please go to &lt;/span&gt;&lt;a class="url" href="http://www.mysql.com/doc/en/ANSI_diff_Foreign_Keys.html" target="_top"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;www.mysql.com/doc/en/ANSI_diff_Foreign_Keys.html&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; for a  discussion on MySQL foreign keys.) This means that records in one table have a  well-defined relationship to records in the other. The database now has all the  information it needs to answer complex queries involving both tables, which it  &lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="908"&gt;&lt;/a&gt;couldn't answer by looking at either table in isolation. With  tables related like this, the database can truly be termed &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;relational.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; The specific relationship described here is also  called a one-to-many relationship. For each record in the player information  table, you may have many records in the match log table. The ability to  construct meaningful one-to-many relationships is a good indicator that your  database meets the requirements of the second normal form.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="909"&gt;&lt;/a&gt;Third Normal Form (3NF)&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The third normal form's goal is to eliminate fields that do  not depend on the primary key.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This is where the real world and the elegance of theory can  collide. To some extent, it reverses the premise of a master table relationship  by suggesting that anytime you may have data repeat in a record such as ZIP  codes in a list of addresses, that data should be stored in a separate table and  linked back to the individual records that use them with a new keyed  relationship. Make no mistake; the purists will chastise you roundly for not  doing it this way. But the truth is, database design is often a series of  trade-offs; and you do sometimes have to weigh design idealism against a novel  but useful concept—simplicity. The requirements of the third normal form simply  may not satisfy your needs; and it's all right for you to decide on a  case-by-case basis what will work best for any given situation.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="910"&gt;&lt;/a&gt;Other Normal Forms&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Believe it or not, there are more normal forms, the fourth  and fifth among them. The fourth normal form states that you should isolate  independent multiple relationships. This rule primarily seeks to deal with the  problems of many-to-many relationships, where many records may have  relationships to intersecting records in another table that may in turn link  back to multiple records in the first table. Confused? Don't feel bad. This is  where things get pretty hairy and you don't need to hold yourself accountable to  this standard. The concept is placed here because you may very well encounter  this situation down the road and it's useful as a strong suggestion for dealing  with these issues.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="911"&gt;&lt;/a&gt;Talking to Databases with SQL&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;At this point, you probably aren't at all surprised to learn  that MySQL itself is a relational database. In fact, you're about to start  applying the principles we've just been discussing with your very own database  engine. First, though, you need to learn a little about the language used to  interact with relational databases—a language called SQL.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SQL, the Structured Query Language, is a standard command set used  to communicate with a relational database management system on any given  platform. Every task such as creating databases or tables, as well as saving,  retrieving, deleting, and updating data from databases, is done via SQL  statements. Implementation of SQL features vary among RDBMS vendors, but because  the basic concepts are identical, applying skills learned on one platform to  another should be no more difficult than porting a computer program written for  one platform to another using the same language. In this section you'll examine  some basic features of SQL: data types, indexes, keys, and queries.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;blockquote class="blockquote"&gt; &lt;div class="first-para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;There are some differences in the way  MySQL implements certain things and the ANSI SQL standard. You can check out a  list ofthese differences at &lt;/span&gt;&lt;/i&gt;&lt;a class="url" href="http://www.mysql.com/doc/en/Differences_from_ANSI.html" target="_top"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;www.mysql.com/doc/en/Differences_from_ANSI.html&lt;/span&gt;&lt;/i&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="912"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="913"&gt;&lt;/a&gt;SQL Data Types&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;When you create a database table, the type and size of each  field must be defined. A field is similar to a PHP variable except that you can  store only the specified type and size of data in a given field. Therefore,  unlike PHP variables, you can't insert characters into an integer field, for  example. The three usual sets of data types are supported in MySQL: numeric,  date/time, and characters, which are described in the following tables:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informaltable"&gt; &lt;table border="1"&gt;&lt;thead&gt;
&lt;tr valign="top"&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Numeric Data Types&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Description&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Range/Format&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt; &lt;tbody&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;INT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Normal-sized integer&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;(-231 to 231 -1), or (0 to 232 -1) if &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UNSIGNED&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;TINYINT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Very small integer&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;(-27 to 27 -1), or (0 to 28 -1) if &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UNSIGNED&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SMALLINT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Small integer&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;( -215 to 215 -1), or (0 to 28 -1) if &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UNSIGNE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;D&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MEDIUMINT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Medium-sized integer&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;(-223 to 223 -1), or (0 to 224 • -1) if  UNSIGNED&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;BIGINT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Large integer&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;(-263 to 263 -1), or (0 to 264 -1) if &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UNSIGNE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;D&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;FLOAT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Single-precision floating-point number&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Minimum non-zero ±1.176 × 10 - 38; maximum non-zero ±3.403 ×  10 + 38&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DOUBLE/REAL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Double-precision floating-point number&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Minimum non-zero ±2.225 × 10 - 308; maximum non-zero ±1.798  × 10 + 308&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DECIMAL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Float stored as string&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Maximum range same as &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DOUBLE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="informaltable"&gt; &lt;table border="1"&gt;&lt;thead&gt;
&lt;tr valign="top"&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Date/Time Data Types&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Description&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Range/Format&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt; &lt;tbody&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DATE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Date&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;YYYY-MM-DD format. Range 1000-01-01 to  9999-12-31&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DATETIME&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Date and time&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;YYYY-MM-DD hh:mm:ss format. Range 1000-01-01 00:00:00 to  9999-12-31 23:59:59&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;TIMESTAMP&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Timestamp&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;YYYYMMDDhhmmss format. Range 19700101000000 to sometime in  2037&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;TIME&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Time&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;hh:mm:ss format. Range -838:59:59 to 838:59:59&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;YEAR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Year&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;YYYY format. Range 1900 to  2155&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="914"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="informaltable"&gt; &lt;table border="1"&gt;&lt;thead&gt;
&lt;tr valign="top"&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Character Data Types&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Description&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt; &lt;th align="left" class="th" scope="col"&gt; &lt;div class="table-para"&gt;&lt;b class="bold"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Range/Format&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt; &lt;tbody&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;CHAR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Fixed-length string&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;0–255 characters&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Variable-length string&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;0–255 characters&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;BLOB&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Binary Large Object&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Binary data 0-65535 bytes long&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;TINYBLOB&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Small BLOB value&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Binary data 0–255 bytes long&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MEDIUMBLOB&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Medium-sized BLOB&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Binary data 0-16777215 bytes long&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;LONGBLOB&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Large BLOB value&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Binary data 0-4294967295 bytes long&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;TEXT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Normal-sized text field&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;0-65535 bytes&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;TINYTEXT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Small text field&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;0–255 bytes&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MEDIUMTEXT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Medium-sized text&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;0-16777215 bytes&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;LONGTEXT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Large text field&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;0-4294967295 bytes&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;ENUM&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Enumeration&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Column values are assigned one value from a set  list&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign="top"&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SET&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Set value(s)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td align="left" class="td"&gt; &lt;div class="table-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Column values are assigned zero or more values from a set  list&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The difference between a &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;CHAR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; type field is that the former stores a fixed-length  value no matter how short it may be, whereas the latter stores exactly as many  bytes as necessary to keep a given value. Suppose you insert the string &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;dodge&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; into the fields defined as &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;char_field  CHAR(10)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;varchar_field(10)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, for example.  They will store the same string slightly differently:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;char_field: 'dodge     '// five blank spaces are right padded
varchar_field: 'dodge' // no space
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It follows that declaring character fields as &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; type will save you some disk space. Don't be tempted  to use &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; type fields for storing every string,  though, because that has drawbacks, too. The MySQL server processes &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;CHAR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; type fields much faster than &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; type, for one thing, because their length is  predetermined. If your strings don't vary in length much, you're better off  using &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;CHAR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; type fields. Moreover, when your strings are  all the same length, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; takes up more disk space,  because it has to store the length of each string in one additional byte.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;A final note on &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR/CHAR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; type  fields: if your table has at least one &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; field,  all character fields are converted to &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;VARCHAR&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; type even  if you define them otherwise.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="915"&gt;&lt;/a&gt;Indexes and Keys&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Inexperienced database designers sometimes complain about  their database engines being slow, a problem that's often explained by the lack  of an &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;index.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; An index is a separate sorted list of a  selected field (or fields) in a table. To explain why indexing a table has a  dramatic effect on database performance, first consider a table without indexes.  Such a table is basically the same as a plain text file because the &lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="916"&gt;&lt;/a&gt;database engine must search it sequentially. Rows in a relational  database are not inserted in any particular order—the server inserts them in an  arbitrary manner. To make sure it finds all entries matching the information you  want, the engine must perform a full table scan, which is slow and inefficient,  particularly if there are only a few matches.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Now consider an indexed table. Instead of moving straight to the  table, the engine can scan the index for items that match your requirements.  Because the index is a sorted list, this scan can be performed very quickly. The  index guides the engine to the relevant matches on the database table, and a  full table scan is not necessary.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;So why not just sort the table itself? This might be practical if  you knew that there was only one field on which you might want to search.  However, this is rarely the case. Because it's not possible to sort a database  by several fields at once, the best option is to use an index, which is separate  from the table.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;What about the case of searching multiple tables at once? This is  where you &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;really&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; benefit from an index. Searching for a  possible match across joined databases without indexes is a terrible idea—the  engine would have to check all possible combinations of rows in one table with  those in another. For two tables each with 500 rows, this would be 500 times  500, or 250,000 combinations! Indexing speeds searches up dramatically. The  engine checks the index of the first table to find the position of matches to  the first part of the query, and then it uses the index to the second table to  find matches to the second part of the query. In other words, you pull out the  relevant records directly.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;A &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;primary key&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; is a special index that, as  you saw at the beginning of the chapter, is used to ID records and to relate  tables to one another, providing the relational database model. Each related  table must have one (and only one) primary key.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Indexes and primary keys can be derived from combinations of  fields. For a key to be formed in this way, the combination of items from each  field must still be unique.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Because an index brings about a significant boost in performance,  you could create as many indexes as possible for maximum performance gain,  right? Not always. An index is a sure-fire way to increase the speed of  searching and retrieving data from a database, but sacrifices performance when  saving or updating records, and also increases the size of a table. Why? When  you insert a record into an indexed table, the database engine has to record its  position in the corresponding index table. Do the math!&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;What's more, if you have more than one index on a table,  multiple write operations have to be performed on the index table, too. So when  creating indexes on a table, don't create more than you need. Limit indexed  columns to those that will be searched or sorted frequently. If required, you  can create additional indexes on a table as you need them to increase  performance.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="917"&gt;&lt;/a&gt;Queries&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SQL &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;statements&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; or &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;commands&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; are used to construct queries. Queries are the  questions your application asks a database engine, which then returns the  records that meet the criteria specified in the query. Queries return an array  of records that meet the specified conditions, and contain information from  selected fields. PHP, and other languages that support database connectivity for  that matter, can treat the returned array as a normal array variable. We'll  return to this topic later; for now, just bear it in mind. The returned array of  records, called the result set, is the database engine's answer to your query.  If you ask the engine to retrieve the records containing John as the first name,  for example, it returns all of the records conforming to the query. If none are  found, NULL (discussed in the &lt;/span&gt;&lt;a class="chapterjump" href="http://www.blogger.com/post-create.g?blogID=995644850464800479" target="_parent"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;next section&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;) is returned.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="918"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Some SQL commands are literally commands that tell the database  engine to do something instead of asking for an answer: "Delete those rows of  information that contain John as the first name!" SQL commands of this type  don't return a result set.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="section"&gt; &lt;h5 class="sect5-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="919"&gt;&lt;/a&gt;NULL&lt;/span&gt;&lt;/h5&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Consider the following scenarios:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;A class takes a spelling test at school, but the teacher has yet  to mark the test sheets and insert the results into a database table. It would  be unfair of the teacher to insert default values into the results column before  the sheets have been marked because a default score is irrelevant in this  context. What could you place in the column to signify that you are awaiting  data?&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You want to construct a database table containing information  about endangered bird species. One of the fields provides the fastest recorded  flight speed for each bird in the table. You begin to create records for  endangered penguins, and then you remember—penguins can't fly! What do you place  in the flight speed column to indicate that the field is not applicable to  penguins?&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;In both of these cases data is missing from a table. The only  difference is that, in the first case, the situation is temporary because the  teacher will soon add the missing test results to the table, but in the second  case the values for the flight speed of penguins is impossible to obtain. You  need a way to represent missing data in fields.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;In a MySQL table, a &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; entry represents  a missing value. &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; doesn't belong to any particular  data type, but it can replace any value. Because it is not a data type or value,  but it can be a field entry, the concept of a &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; is  often difficult to grasp for beginners and experienced programmers alike.  Programmers often have a mistaken idea of &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;. For  example, a common mistake is to think of &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; as zero,  which is wrong because zero is a value; &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; is not.  Strings filled with one or more blank spaces, and strings of zero length, may  also be mistaken for &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; because string is a data  type, but &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; isn't. &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; is  nothing, no data type, no value.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;So what happens if the result set from one of your queries  contains a &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, and that result set is then used in  your program in subsequent calculations? The rule of thumb for math with &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; is that it propagates. Any arithmetic operation  involving a &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; returns &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;.  This makes sense because how could you provide results when all the data needed  to perform the calculation is not present? This also applies to dividing a &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; value by zero; &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; is  returned.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h5 class="sect5-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="920"&gt;&lt;/a&gt;Query Commands&lt;/span&gt;&lt;/h5&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MySQL queries issued to manipulate data in a table can be  constructed using the following main commands:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: Retrieves data from a  database.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DELETE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: Deletes data from a  database.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;INSERT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;—Inserts data into a  database.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;REPLACE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: Replaces data in a  database. If the same record exists in a table, the command overwrites the  record with the new data.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;UPDATE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: Updates data in a  table.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="921"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The rest of the command set involves creating or modifying the  database structures, rather than the data stored in the databanse:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;CREATE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: Creates a database, table  or index.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;ALTER&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: Modifies the structure of a  table.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;DROP&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;: Wipes out a database or  table.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You'll see more of these commands as you work through the next few  chapters. Just to give you a taste though, let's take a look at the typical form  of a MySQL &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; query, which retrieves records from a  table:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; SELECT field1, field2, ... , fieldn FROM table WHERE condition;
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The first thing to note is that each query is terminated with a  semicolon, just as a PHP statement is. A query statement may expand to multiple  lines. The following, slightly more specific query, is essentially the same as  this generic case:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql&amp;gt; SELECT last_name, first_name
    -&amp;gt; FROM user
    -&amp;gt; WHERE first_name = 'John'
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Take a closer look at the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;FROM&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;WHERE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;ORDER BY&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; clauses in the  query. The query returns any record &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;from&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; the user table &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;where&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; the value of the first_name field is John. Assuming you  have a table called user, here's a sample of the query's output:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Simpleton John
Smith John
Thomas John
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Now let's put this into practice and have some fun with  MySQL!&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-2199522324308783644?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/2199522324308783644?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/2199522324308783644?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2010/12/relational-databases.html" title="Relational Databases" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;Dk8CQXo-fyp7ImA9Wx9SFUs.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-8699998268319269625</id><published>2010-12-06T00:01:00.005+08:00</published><updated>2010-12-06T00:01:00.457+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-06T00:01:00.457+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="setting up mysql" /><title>Setting up MySQL</title><content type="html">&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You'll use MySQL for the database examples in this book, so  you need to get it up and running.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;At time of writing, the latest production release is MySQL 4.0,  and you can find the server files (both as source code and as precompiled  binaries for a wide range of platforms) on the MySQL site at &lt;/span&gt;&lt;a class="url" href="http://www.mysql.com/downloads/mysql-4.0.html" target="_top"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;www.mysql.com/downloads/mysql-4.0.html&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Details of installation (such as how you install it, and where the  crucial files end up) can vary quite a lot, depending on factors such as the  operating system you use and the particular type (source code or precompiled) of  MySQL package you've downloaded, so let's look at several different versions of  the installation process.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="891"&gt;&lt;/a&gt;Installing on Windows&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The Windows binary is provided as a ZIP file (for example,  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql-4.0.16-win.zip&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;) containing a number of files  including an executable called &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;setup.exe&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;. Run this  file, and an installation wizard prompts you with a few settings options. These  just determine which files are to be installed and where they are to be stored.  The defaults (a Typical install in &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;C:\MySQL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;) should be  fine.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;All of the core MySQL programs are stored in the bin directory of  your installation. Assuming you've gone with the default settings, you'll find  them in C:\mysql\bin. Most of these programs (such as &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql.exe&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysqladmin.exe&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysqld.exe&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;) are command-line tools, so do not try to run them  by double-clicking their icons. You'll see them in action a little later on.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;One very useful tool that comes with the standard Windows release  of MySQL is the snappily titled &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;winmysqladmin.exe&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;,  which provides you with a useful interface for controlling the MySQL server  program. It's a graphical program, so you can run it by double-clicking as  normal.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The first time you run it, you're prompted to enter a username and  password, which generate a database user account for the administration tool to  use. The administration tool then starts the MySQL server program, which, if  installed properly, should come up first time.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Once it's running, winmysqladmin hides itself in your system tray  (at the right-hand end of your Start bar), where it's represented by a traffic  light. A green (go) light shows when the server's running, and a red (stop)  light when it's not.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Right-clicking the icon brings up a menu that enables you to start  and stop the server, and shows the winmysqladmin window&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;from which you can view and edit various parameters on the server.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="figure"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif; font-size: 19px; font-weight: bold;"&gt;Installing on Linux&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Linux users can install MySQL from a package or by compiling  from source code. If you're after RPMs, then make sure you download the server,  the client, the include files and libraries, and the client shared libraries for  the correct platform. You should end up with the following four files (although  the exact names may vary according to the MySQL version and OS you're working  with):&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MySQL-4.0.16.i386.rpm&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MySQL-client-4.0.16.i386.rpm&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MySQL-devel-4.0.16.i386.rpm&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MySQL-shared-4.0.16.i386.rpm&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you're after the source code, you just need the tarball, &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysql-4.0.18.tar.gz&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="895"&gt;&lt;/a&gt;Installing MySQL using RPMs&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Install RPMs using the following command:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt; rpm -Uvh filename.rpm
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Install them in the order listed in the preceding section.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="896"&gt;&lt;/a&gt; &lt;/span&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;When you install the first package, which contains the MySQL  server, the following documentation appears on the screen:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
This is done with:&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
/usr/bin/mysqladmin -u root password 'new-password'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at http://www.
mysql.com&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
Support MySQL by buying support/licenses at http://www.tcx.se/license.htmy.&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
Starting mysqld daemon with databases from /var/lib/mysql
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The mysqladmin program is one of the client tools, so you have to  wait to set your password until after you install the client package, which  you'll do a little later in this chapter. However, the RPM immediately starts up  the MySQL server program mysqld (for MySQL daemon). It also creates the startup  and shutdown script &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;/etc/rc.d/init.d/mysql&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, that  ensures that MySQL starts whenever your computer is booted, and shuts down  conveniently whenever it is halted. You can use this script to start and stop  mysqld, with the commands:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt; /etc/init.d/mysql start

&amp;gt; /etc/init.d/mysql stop
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Now install the MySQL-client, MySQL-devel, and MySQL-shared  packages, and you are ready to move on to &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Configuring  MySQL&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; section of this chapter.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="897"&gt;&lt;/a&gt;Installing MySQL From Source&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It's fairly simple to install MySQL source code. Downloaded  the mysql tarball from the MySQL Web site and install it like this:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt; tar -zxvf mysql-4.0.18.tar.gz
&amp;gt; cd mysql-4.0.18
&amp;gt; ./configure --prefix=/usr
&amp;gt; make
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;make&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; fails, it is often because of a  lack of memory, even on fairly high-spec machines. In that case, try:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt; rm -f config.cache
&amp;gt; make clean
&amp;gt; ./configure --prefix=/usr --with-low-memory
&amp;gt; make
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If that doesn't work, you may find some help at &lt;/span&gt;&lt;a class="url" href="http://www.mysql.com/doc/en/Compilation_problems.html" target="_top"&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;www.mysql.com/doc/en/Compilation_problems.html&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Assuming &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;configure&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; and &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;make&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; have run without a hitch, simply run the following  statements to complete the installation:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt; make install
&amp;gt; mysgl_install_db
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="898"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You need some scripts to start and stop the MySQL server, mysqld.  Here's one typical startup script:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;#!/bin/bash
/usr/bin/mysqld_safe &amp;amp;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;And one typical script to shut the server down:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;#!/bin/bash
kill 'cat /usr/var/$HOSTNAME.pid'
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;These scripts are in the source code download for this book (&lt;/span&gt;&lt;a class="url" href="http://www.wrox.com/" target="_top"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;www.wrox.com&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;). If you  choose to create startup and stop scripts yourself, produce the files using your  favorite text editor, and then use the &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;chmod&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; command to  tell the system that they are executable scripts. If you saved the startup  script as &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;startmysqld&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, for example, you would need to  type:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt; chmod ugo+rx startmysqld
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="899"&gt;&lt;/a&gt;Configuring MySQL&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;With the MySQL database engine installed and running on your  local test machine, take a few moments to configure the system.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MySQL, like most networked systems (including other client-server  databases, operating systems, and many more besides), requires you to log in  with a specific user account before doing anything else. This is a fairly  obvious security measure, and it limits access to the data by specifying  permissions for each account. For example, one user may only have permission to  view existing data; another may have permission to add new data, and perhaps  even change other users' permissions.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;root&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; is the name traditionally given to a  system's most senior user, who automatically has permission to view and modify  &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;all&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; data and settings: a powerful position to be in. When  MySQL installs, it creates the root account automatically, but doesn't set a  password for it! Right now, your pristine installation could be wide open to use  and abuse by anyone with a MySQL client and a network connection to the server,  and you need to do something about that.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;To set up a root account from the command line, follow these  steps:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ol class="orderedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Call up a command prompt and navigate to the directory  containing the MySQL program files (typically C:\mysql\bin\ on Windows or  /usr/bin/ on Linux).&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Type in the following command, substituting a suitably  obscure password of your own in place of elephant:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt; mysqladmin -uroot password elephant
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;With the command line still in place, try out a few commands. For  example, executing the command &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysqlshow&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; gives you a  list of the databases currently available through your server:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt; mysqlshow
+-----------+
| Databases |
+-----------+
| mysql     |
| test      |
+-----------+
&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="900"&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Right now it shows that the server has already created two  databases for itself. The first, called mysql, is where it stores all the  information it uses to authenticate users. The second is an empty test database,  &lt;/span&gt;&lt;span class="fixed"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;mysqlshow&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; can also show you what's inside a database,  as long as you have the correct password:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;gt; mysqlshow -uroot -p mysql
Enter password: ********
Database: mysql
+--------------+
|   Tables     |
+--------------+
| columns_priv |
| db           |
| func         |
| host         |
| tables_priv  |
| user         |
+--------------+
&lt;/span&gt;&lt;/pre&gt;&lt;pre class="literallayout"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;So here's another clue about what's lurking inside that mysql  database—all the system data is arranged into six named tables. This is your  first direct glimpse of the data storage model that MySQL uses to organize its  data. Before you dig any deeper, let's take a quick look at some more theory,  and see how collections of tables such as these help you store data efficiently.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-8699998268319269625?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/8699998268319269625?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/8699998268319269625?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2010/12/setting-up-mysql.html" title="Setting up MySQL" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;CkcCQX8-fCp7ImA9Wx9TGUs.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-8141531659848023493</id><published>2010-11-29T00:01:00.005+08:00</published><updated>2010-11-29T00:01:00.154+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-29T00:01:00.154+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="storing data" /><title>Storing Data</title><content type="html">&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Whenever you start work on a data-driven application, one of  the first design decisions you have to make is this: what's the best data store  to use? In other words, how and where is the application going to store and  access its data. The correct choice is always going to depend on the  application's requirements. At the simplest level, you should be asking  questions like:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;How much data will the application use?&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;How often will it need access to the data?&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;How often will it need to modify the data?&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;How many users are likely to want access to the data at  once?&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;How will the data grow over time?&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;How much do I stand to lose if the data is broken, stolen,  or lost?&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If the answer to any of these questions is "a lot," then you  probably want to steer clear of using plain text files to store your data.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;blockquote class="blockquote"&gt; &lt;div class="first-para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;That's not to say that text files are  useless—for instance, when visitors attempt to enter a password-protected area,  an Apache Web server (unless configured otherwise) authenticates them against a  plain text file containing a complete list of user IDs and passwords. This isn't  a problem as long as it's dealing with a small group of users, but if it has to  validate hundreds at the same time, it must scan the text file one line at a  time until it finds a match. One unlucky user would have to wait for Apache to  find his details on the last line of the file before it let him enter the  password-protected area, and that could cost quite some time.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Often, the most efficient alternative is to use a database  engine—or to use its more technical name, a Database Management System (DBMS)—to  store, retrieve, and modify the data for you. A good database engine really just  serves as a very, very smart go-between for you and your data. It organizes,  catalogs, backs up, and a whole lot more besides, all with a view toward making  that data quicker and easier to work with.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;So where does all the data go? Well, it depends to some extent on  the database engine you're using. Chances are, though, it'll end up being stored  as streams of bits and bytes in a number of files—yes, files! Truth is you can't  really get away from using files at some point. The trick is in finding ways to  use them as efficiently as possible, and a good database engine has many, many  such tricks up its metaphorical sleeves.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="882"&gt;&lt;/a&gt;Databases and Databases&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;At this point it's worth taking a moment to look at exactly  what the word database refers to. Strictly speaking, a database is just an  efficiently organized collection of data, just as a library is really no more  than an ordered collection of books. However, everyone tends to use the word  library to refer to the &lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="883"&gt;&lt;/a&gt;institution as a whole—not just the  books, but the staff, its working practices, and the building, too—and the same  is true of databases. So, when you hear someone talk about a database, he's more  than likely referring to the whole caboodle: the database engine &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;and&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; the data.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This isn't so surprising because under normal circumstances  the only contact you ever have with the raw data is through the DBMS, or  database engine to be slightly less formal. Most of the time you never see the  join, so there's no real practical distinction. Later we discuss installing the  database, connecting to the database, talking to the database, and so on—just  remember that we're using the word in its more common, all-encompassing  sense.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="884"&gt;&lt;/a&gt;Database Architectures&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Before we get going here, you need to settle on a particular  database with which to experiment, and that means first deciding on the type of  database architecture you're going to use. There are two main options: embedded  and client/server. Let's take a quick look at both.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="885"&gt;&lt;/a&gt;Embedded Databases&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;An embedded database runs—and stores its data—on the same  machine as the program that wants to use it (PHP in this case). The database is  not networked, and only one program can connect to it at any given time.  Moreover, the database can't be shared between different machines because each  one would simply end up storing and manipulating its own separate version of the  data. It's analogous to having your own personal library, staff and all, to  which you have exclusive access. For smaller applications there can often be  advantages to using an embedded database. For larger systems, the advantages  provided by the larger Relational Database Management Systems (RDBMS) tip the  scales in their favor and as a result, most commercial enterprises use  client/server database architectures.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Long-standing, popular examples of embedded database engines  include dBase and DBM, and PHP provides connectivity to both. A more recent  addition to the fold is SQLite, which is not just available as a PHP5 extension,  but is actually bundled as part of the PHP5 download. For that reason alone it's  well worth a look, and some impressive performance stats certainly help back up  its placement as the rising star of PHP database technologies. You can learn  more about SQLite in &lt;/span&gt;&lt;a class="chapterjump" href="http://www.blogger.com/post-create.g?blogID=995644850464800479" target="_parent"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Appendix C&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;, &lt;/span&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Using SQLite.&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h4 class="sect4-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="886"&gt;&lt;/a&gt;Client/Server Databases&lt;/span&gt;&lt;/h4&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Client/server databases are designed for use over networks,  enabling multiple users (who may be scattered across a whole host of different  locations) to work simultaneously with the same data. The database (the term  database is also often used as shorthand for Database Management System, or  DBMS) itself acts as a server, not unlike the Web servers discussed in the  opening chapters. In principle it can field requests from just about anywhere  with a network connection and a suitable client program. That said, there's no  reason why you can't run both on the same machine.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Client/server databases are more closely analogous to the earlier  metaphor of the public lending library. It's open to anyone who has a membership  card (is registered with the library) and, with several staff members on the  reception desk, can deal with requests from a number of visitors at once. The  visitors may be there in person, or may call in on the telephone.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The actual job of finding or returning a book to the shelf might  then be delegated to an assistant, but visitors don't need to worry about that.  Each receptionist may have to deal with several visitors at once, &lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="887"&gt;&lt;/a&gt;but if he's good at his job, he'll spend a reasonable amount of  time on each, and all visitors feel that they're getting good service. Likewise,  when several users access a client/server database engine at the same time, the  engine regularly switches its attention among them, giving each one the sense  that she's being attended to all the while.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This is the kind of database you're more likely to find being used  in a large company, where large quantities of data need to be shared among large  numbers of people, where access may be needed from all sorts of different  locations, and where having a single centralized data store makes important jobs  like administration and backup relatively straightforward. Any applications that  need to access the database use specialized, lightweight client programs to  communicate with the server.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;RDBMSs (Relational Database Management Systems) are often  expensive and complex to set up and administer. The widely acknowledged big  three in this field are Oracle, DB/2 (from IBM), and SQL Server (from  Microsoft). All three are massive, feature-rich systems, seemingly capable of  just about any kind of data storage and processing that a modern business could  need. The flip side of the coin is that these systems are big and expensive, and  may contain more functionality than you will ever need.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Fortunately there are alternatives such as PostgreSQL and  MySQL, which are both Open Source client/server database systems that have  proven very popular with PHP developers for many years. They're fast, stable,  easily meet the needs of most small-to-medium sized projects, and, to top it  all, they're free!&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="888"&gt;&lt;/a&gt;Choosing a Database&lt;/span&gt;&lt;/h3&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;In principle, you can use any of these database systems in  your PHP applications. There's even no reason why you can't hook one application  up to several different database engines. To keep these chapters to a reasonable  length, however, the focus will be on just one—MySQL.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Compared to the other choices, it offers several advantages:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ul class="itemizedlist"&gt;&lt;li class="first-listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It's one of the most popular databases being used on the Web  today.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It's freely available as a download to install and run on  your own machine.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It's easy to install on a wide range of operating systems  (including Windows and UNIX).&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It's available as a relatively cheap feature in many  Web-hosting packages.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It's simple to use and includes some handy administration  tools.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li class="listitem"&gt; &lt;div class="first-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It's a fast, powerful client/server system that copes well  with very large, complex databases, and should stand you in good stead when it  comes to larger projects.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you're not too fussed about the last criterion (and  particularly if you don't want to pay out extra for database functionality on  your Web account!) you might well find that an embedded database such as SQLite  does a perfectly good job.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;blockquote class="blockquote"&gt; &lt;div class="first-para"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;MySQL is a freely available RDBMS, which  fully joined the Open Source Community only recently, when it was released under  the GNU Public License (GPL). Even before it went free, you didn't need a  license unless you wanted to make money out of it, or run the server on the  Windows platform (the Windows version of MySQL was shareware). Because you now  don't have to pay a dime to use it, this alone makes &lt;/span&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="" name="889"&gt;&lt;/a&gt;MySQL a  solid candidate for developing database applications. If the GPL worries you for  any reason, or you need to incorporate MySQL into a commercial application, you  can still buy a commercially licensed version from the developers at &lt;/span&gt;&lt;/i&gt;&lt;a class="url" href="http://www.mysql.com/" target="_top"&gt;&lt;i class="emphasis"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;www.mysql.com&lt;/span&gt;&lt;/i&gt;&lt;/a&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="last-para"&gt;&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;That said, a lot of the concepts to be introduced here and in  the following chapters extend well beyond one specific database engine, so I  still recommend following along with MySQL for the time being.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-8141531659848023493?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/8141531659848023493?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/8141531659848023493?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2010/11/storing-data.html" title="Storing Data" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;D0UCQHw6fCp7ImA9Wx9TE0g.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-488247519538978192</id><published>2010-11-22T00:01:00.003+08:00</published><updated>2010-11-22T00:01:01.214+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-22T00:01:01.214+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="databases and sql" /><title>Chapter 9: An Introduction to Databases and SQL</title><content type="html">&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;You've spent the last couple of chapters seeing how your PHP scripts can use external files to store and retrieve data. Although direct file access does a great job in many circumstances, it's pretty limited as data storage solutions go—what you see is what you get, no more, no less. Any sifting, sorting, or other work that has to be done on the data ultimately falls to you and your scripts, and the more data there is to handle, the longer it takes the script to deal with it. This might not present much of a problem when you're dealing with a few kilobytes of data, but who's to say when those kilobytes will grow into megabytes (or even gigabytes) of data. If you're actively setting out to build a successful, popular, data-driven Web site, you really have to allow for that volume possibility.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Just think—if a large commercial site such as Amazon accessed all its data directly from plain text files, it could take you months just to track down a single book, let alone place an order!&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Databases are specifically designed to get around this problem. With their own special capabilities of organization and immaculate record keeping, you can almost imagine them as the super-hero staffed lending libraries of the IT world. No more searching for hours through shelves of musty tomes; just a word at the front desk, a blur of blue and red, and the last remaining copy of Love in the Time of Cholera appears—as if by magic—on the desk in front of you.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This is the first in a series of three chapters in which you'll explore databases and learn how you can use them to start creating powerful, efficient (and potentially very large) PHP applications. You'll examine the general advantages of using databases rather than files to store your data. You'll also learn about some of the popular databases that you're likely to come across, and how they differ.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Relational databases will be explained, and you'll explore related concepts such as normalization and indexing. You'll see how to set up MySQL, a database system that's freely available and widely used with PHP, and learn some PHP functions for connecting to a database in MySQL as well as how to use MySQL to retrieve and modify the contents of a database.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;There's a lot of ground to cover in this chapter, so you may find it's a little heavier on theory than most. It won't all be brain strain, but the practical element involves getting a database up and running on your test machine, and that will be a lot easier if you already understand what's needed. For that reason, PHP itself takes something of a back seat until the last few sections, when you hook PHP up to your working database in preparation for the next two chapters. If you're someone who's already familiar with databases and how they work, you may want to skip straight on to that—otherwise, it all starts right here!&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-488247519538978192?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/488247519538978192?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/488247519538978192?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2010/11/chapter-9-introduction-to-databases-and.html" title="Chapter 9: An Introduction to Databases and SQL" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;CkMCQX8ycCp7ImA9Wx5aF0g.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-7844513392489198202</id><published>2010-11-15T00:01:00.001+08:00</published><updated>2010-11-15T00:01:00.198+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-15T00:01:00.198+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="online lead finder" /><title>Online Lead Finder Update</title><content type="html">&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;A new update to the Online Lead Finder has been posted today in the members area.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;http://www.onlineleadfinder.com/login.php&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Following fixes done:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;1. Craigslist problem solved, many results were going to "Page notfound" as craigslist again changed something in their structure.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;2. Auto Campaigning Pause Interval reduced to default 1 minute, now stop buttonwould work faster.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;3. Problems on Twitter Stop Messaging button solved.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;Next month, we will be releasing some brand new features for current members.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Remember, you have to stay on our mailing list to get your free updates.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-7844513392489198202?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/7844513392489198202?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/7844513392489198202?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2010/11/online-lead-finder-update.html" title="Online Lead Finder Update" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;D0ECQH4-cCp7ImA9Wx5aEUk.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-5491069659007098260</id><published>2010-11-08T00:01:00.008+08:00</published><updated>2010-11-08T00:01:01.058+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-08T00:01:01.058+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="internet marketing" /><title>Hooked on Overages Webinar</title><content type="html">&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;I never expected the kind of results my friend Rick Dawson is seeing today.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;He's an investor who changed just one thing in his business and now has five-figure finder-fee checks showing up in his mailbox like clockwork.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;What's the change?&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;I promised Rick the only thing I'd say is that it's a new twist on an old technique. One thing's for sure, it flat-out works.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;He even let me see a couple checks that came in last month - one for $18k+.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Rick's created an Insider's Guide, "Five-Figure Finder-Fees With Real Estate Unclaimed Funds". It's jam-packed with info and you'll get it right away when you register for Rick's "Hooked on Overages" webinar:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;**************************&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;When: Tuesday, November 15th&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Time: &amp;nbsp;9:00 PM Eastern/6:00PM Pacific&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Click below or copy and paste the link into your internet browser to register and get the call in details.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Space is limited. &amp;nbsp;Reserve your Webinar seat now at:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="https://www2.gotomeeting.com/register/179853899"&gt;https://www2.gotomeeting.com/register/179853899&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;**************************&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Snatch it while you still can because this one thing really does change EVERYTHING.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;From the reaction he's getting from guys who don't want this info made public, my guess is it won't be up much longer, so go get it right now.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Rick has already trained a number of students who are not happy this information is being put out again - grab it before he takes it down.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Space is limited. &amp;nbsp;Reserve your Webinar seat now at:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="https://www2.gotomeeting.com/register/179853899"&gt;https://www2.gotomeeting.com/register/179853899&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-5491069659007098260?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/5491069659007098260?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/5491069659007098260?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2010/11/hooked-on-overages-webinar.html" title="Hooked on Overages Webinar" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;Ck8CQXszfCp7ImA9Wx5bFUk.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-5033487534458333193</id><published>2010-11-01T00:01:00.007+08:00</published><updated>2010-11-01T00:01:00.584+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-01T00:01:00.584+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="magic bullet system" /><title>Magic Bullet System - Video Training</title><content type="html">&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Hey - this is super cool:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1lSJpz70XwcD0P&amp;amp;b=rTskTdSAGi.7HfnE0ix30g"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1lSJpz70XwcD0P&amp;amp;b=rTskTdSAGi.7HfnE0ix30g&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It's a brand new video that shows&amp;nbsp;a virtually UNKNOWN way to get&amp;nbsp;tons of traffic to *any* website.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It doesn't matter if it's your website or if&amp;nbsp;you're sending traffic straight to an affiliate link&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;...it works just the same.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;In fact, the guys in the video are bringing in&amp;nbsp;756.15 per DAY with this method ...and they're&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;not even using their own site. They're sending&amp;nbsp;traffic straight to an affiliate link!&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Check it out:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1lSJpz70XwcD0P&amp;amp;b=rTskTdSAGi.7HfnE0ix30g"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1lSJpz70XwcD0P&amp;amp;b=rTskTdSAGi.7HfnE0ix30g&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Seriously, you get to see exactly what site they're&amp;nbsp;promoting, where they're getting traffic, how much&amp;nbsp;they're spending, what their net profit is, and everything&amp;nbsp;else you want to know.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This is an excellent video and it's 100% content:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1lSJpz70XwcD0P&amp;amp;b=rTskTdSAGi.7HfnE0ix30g"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1lSJpz70XwcD0P&amp;amp;b=rTskTdSAGi.7HfnE0ix30g&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;I read a study that Google is only responsible&amp;nbsp;for between 15 and 30% of all traffic out there.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;That means if you're just using Adwords, you're leaving&amp;nbsp;up to 85% of your traffic (and your MONEY) on the table.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;This video shows you one of the greatest traffic sources&amp;nbsp;out there (and nobody in our community is using it!)&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;It's truly excellent. You can watch it here:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1lSJpz70XwcD0P&amp;amp;b=rTskTdSAGi.7HfnE0ix30g"&gt;http://clicks.prosender.com/y/ct/?l=70FmR&amp;amp;m=1lSJpz70XwcD0P&amp;amp;b=rTskTdSAGi.7HfnE0ix30g&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-5033487534458333193?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/5033487534458333193?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/5033487534458333193?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2010/11/magic-bullet-system-video-training.html" title="Magic Bullet System - Video Training" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;DEcCQX0zcSp7ImA9Wx5UGU4.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-3419892457131059488</id><published>2010-10-25T00:01:00.005+08:00</published><updated>2010-10-25T00:01:00.389+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-25T00:01:00.389+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="magic bullet system" /><title>Magic Bullet System - Recorded Seminar</title><content type="html">&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Well the feedback is AWESOME... so thanks!&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The call turned into 60 minutes of PURE content... you will&amp;nbsp;love it!&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Amish answered every question that was thrown at him and I for&amp;nbsp;one am very impressed. These questions were from you there&amp;nbsp;readers and were very pointed!&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Go download the call now and listen.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=Je2ap&amp;amp;m=1eJuWwZY_foH0P&amp;amp;b=U5KeZ6nqa1YJmjKVBzLkmg"&gt;http://clicks.prosender.com/y/ct/?l=Je2ap&amp;amp;m=1eJuWwZY_foH0P&amp;amp;b=U5KeZ6nqa1YJmjKVBzLkmg&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Oh and if you have not already checked out the free stuff that&amp;nbsp;Amish is giving away, then go here... you will like it (well I&amp;nbsp;do anyway).&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;PS - I am giving away the 100% total details of the exact&amp;nbsp;website and promotion strategies i am using for killing it&amp;nbsp;from an seo perspective (and no this is not using Johncow.com&amp;nbsp;but instead a brand new site that is only 1 week old (brand&amp;nbsp;new domain too) and already getting 150+ visitors a day...&amp;nbsp;and i am not paying for any of the traffic. I am going to&amp;nbsp;give you flow charts and everything... but you need to have&amp;nbsp;opt in with this link...&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=Je2ap&amp;amp;m=1eJuWwZY_foH0P&amp;amp;b=AoSF9Wkw8qSdMh13xwbXeg"&gt;http://clicks.prosender.com/y/ct/?l=Je2ap&amp;amp;m=1eJuWwZY_foH0P&amp;amp;b=AoSF9Wkw8qSdMh13xwbXeg&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;I hope you like the call... i did and so did everyone who&amp;nbsp;was one it!&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Again the MP3 is available at...&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=Je2ap&amp;amp;m=1eJuWwZY_foH0P&amp;amp;b=U5KeZ6nqa1YJmjKVBzLkmg"&gt;http://clicks.prosender.com/y/ct/?l=Je2ap&amp;amp;m=1eJuWwZY_foH0P&amp;amp;b=U5KeZ6nqa1YJmjKVBzLkmg&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/995644850464800479-3419892457131059488?l=web-coding-tips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/3419892457131059488?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/995644850464800479/posts/default/3419892457131059488?v=2" /><link rel="alternate" type="text/html" href="http://web-coding-tips.blogspot.com/2010/10/magic-bullet-system-recorded-seminar.html" title="Magic Bullet System - Recorded Seminar" /><author><name>Jeffrey Pineda</name><uri>http://www.blogger.com/profile/12989794661521621615</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="00671825798731084947" /></author></entry><entry gd:etag="W/&quot;C0UCQX0_fSp7ImA9Wx5UE04.&quot;"><id>tag:blogger.com,1999:blog-995644850464800479.post-251123360426714790</id><published>2010-10-18T00:01:00.008+08:00</published><updated>2010-10-18T00:01:00.345+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-18T00:01:00.345+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="magic bullet system" /><title>Magic Bullet System - Call With Amish Shah</title><content type="html">&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Reminder of the call with Amish Shah... where I drill him with&amp;nbsp;blunt straight to the point questions, is at 4pm eastern or 1pm&amp;nbsp;pacific today. To be on the call, go here...&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=Je2ap&amp;amp;m=1fr089LvVfoH0P&amp;amp;b=Gh0o.9b8id19NF5.7pTRHQ"&gt;http://clicks.prosender.com/y/ct/?l=Je2ap&amp;amp;m=1fr089LvVfoH0P&amp;amp;b=Gh0o.9b8id19NF5.7pTRHQ&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Two BIG reasons to be on the call...&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;1. I ask the tough question YOU the reader wanted asked&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;2. I am giving away some stuff to listeners :)&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If you cant make the call, it will be recorded BUT you will not&amp;nbsp;be able to get some of the stuff I am giving away (hint... hint...&amp;nbsp;via PayPal)&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=Je2ap&amp;amp;m=1fr089LvVfoH0P&amp;amp;b=Gh0o.9b8id19NF5.7pTRHQ"&gt;http://clicks.prosender.com/y/ct/?l=Je2ap&amp;amp;m=1fr089LvVfoH0P&amp;amp;b=Gh0o.9b8id19NF5.7pTRHQ&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;So, one more time...&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;The call is on...&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;Tuesday, October 25 (Monday) at 1:00pm Pacific / 4pm Eastern&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;If yo are unsure of time zone, click the link and the count down&amp;nbsp;timer will show you :)&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://clicks.prosender.com/y/ct/?l=Je2ap&amp;amp;m=1fr089LvVfoH0P&amp;amp;b=Gh0o.9b8id19NF5.7pTRHQ"&gt;http://clicks.prosender.com/y/ct/?l=Je2ap&amp;amp;m=1fr089LvVfoH0P&amp;amp;b=Gh0o.9b8id19NF5.7pTRHQ&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Georgia, 'Times New Roman', se
