<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8095570854804033541</id><updated>2011-10-25T10:28:11.840-07:00</updated><title type='text'>PHP Tutorial</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>23</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-7771308136585768803</id><published>2009-03-13T22:37:00.001-07:00</published><updated>2010-12-20T03:26:47.729-08:00</updated><title type='text'>Introduction</title><content type='html'>&lt;p&gt;PHP is a language that was  designed to be easily embedded into HTML pages. Most PHP pages have PHP  code and HTML intermixed. When a Web server reads a PHP page, it is  looking for two things to let it know it should start reading the page as PHP rather than HTML, the start and end PHP tags: &amp;lt;?php and ?&amp;gt;, respectively.&lt;/p&gt;  &lt;p&gt;If  you have configured your php.ini file to accept "short tags" (which are  enabled by default), then you can use the syntax &amp;lt;? and ?&amp;gt;  instead. Additionally, you can configure your php.ini file so that it  accepts ASP style tags, &amp;lt;% and %&amp;gt;. This feature is turned off by default, and its only real purpose seems to be to  allow certain HTML editors to recognize the in-between code as  something other than HTML, in which case the editor won't mangle the  code by imposing its own set of HTML syntax rules upon the code.  &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Get Started:&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&amp;lt;h1&amp;gt;&amp;lt;? echo “First PHP Page.”; ?&amp;gt;!&amp;lt;/h1&amp;gt;&lt;/p&gt;&lt;p&gt;The code above, when viewed via a Web server, simply prints out String enclosed in the quotes.&lt;/p&gt;&lt;p&gt;In  general, individual lines of PHP code should end with a semicolon,  although it is not necessary to use semicolons if a beginning or an  ending bracket is used (this will make sense when you look at if/then  statements).&lt;/p&gt;&lt;p&gt;For example:&lt;/p&gt;&lt;p&gt;&amp;lt;? &lt;/p&gt;&lt;p&gt;echo "&amp;lt;p&amp;gt;a line of code";&lt;/p&gt;&lt;p&gt;echo "&amp;lt;p&amp;gt;another line of code;&lt;/p&gt;&lt;p&gt;?&amp;gt;&lt;/p&gt;                                    &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-7771308136585768803?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/7771308136585768803/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/introduction_13.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/7771308136585768803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/7771308136585768803'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/introduction_13.html' title='Introduction'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-7985782121685410074</id><published>2009-03-13T22:36:00.001-07:00</published><updated>2010-12-20T03:27:02.913-08:00</updated><title type='text'>Variables</title><content type='html'>&lt;p&gt;Variables in PHP are denoted  by the "$". To assign the value "Hello World" to the variable $str, you  simply call it in your code:&lt;/p&gt;&lt;p&gt;$str = "Hello World"; &lt;/p&gt;Strings must be enclosed by quotes, but they can contain variables themselves:&lt;br /&gt;&lt;p&gt;$a = 12; &lt;/p&gt;$string = "The value of a is $a";&lt;br /&gt;&lt;p&gt;// $string = "The Value of a is 12";&lt;/p&gt;PHP  variables do not have to be declared ahead of time, nor do they require  a type definition. Note that you may get a warning about using  undeclared variables if you try to use them before giving them a value  (depending on how you set up error reporting in php.ini). For example:&lt;br /&gt;&lt;p&gt;$a = 4; &lt;/p&gt;$c = $a + $b;&lt;br /&gt;&lt;p&gt;// $c = 4, but a warning appears "Warning: Undefined variable..".&lt;/p&gt;Warnings  do not stop a script from continuing. If you forgot to add a semicolon  at the end of one of the lines, then you would get a Parser error,  which prohibits the script from running.&lt;br /&gt;&lt;p&gt;Since  PHP variables are not typed, you don't have to worry about performing  mathematical equations on the wrong type, as you might in C. For  example:&lt;/p&gt;$a = 4;&lt;br /&gt;&lt;p&gt;$b = "5";&lt;/p&gt;$c = $a + $b;&lt;br /&gt;&lt;p&gt;// $c = 9;&lt;/p&gt;PHP also supports boolean variables, which can be assigned either a one or a zero, or the words true or false:&lt;br /&gt;&lt;p&gt;$a = true; &lt;/p&gt;$b = 1;&lt;br /&gt;&lt;p&gt;//$a = $b&lt;/p&gt;$c = false;&lt;br /&gt;&lt;p&gt;$d = 0;&lt;/p&gt;//$c = $d&lt;br /&gt;&lt;p&gt;&lt;br /&gt;   &lt;strong&gt;Variable Naming Rules&lt;/strong&gt;&lt;br /&gt; &lt;/p&gt;&lt;ol&gt;&lt;li&gt;A variable name must start with a letter or an underscore.&lt;br /&gt;&lt;br /&gt; &lt;/li&gt;  &lt;li&gt;A variable name can only contain alpha-numeric characters and underscores (a-Z, 0-9, and _ )&lt;br /&gt; &lt;/li&gt;&lt;br /&gt; &lt;li&gt;A  variable name should not contain spaces. If a variable name is more  than one word, it should be separated with underscore ($my_string), or  with capitalization ($myString)&lt;br /&gt; &lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;p&gt;&lt;strong&gt;Comments:&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;You  can include comments in your PHP scripts. Comments are ignored by the  Web server, and any comments contained within the PHP code are not sent  to a browser. There are three forms of comments:&lt;/p&gt;&lt;p&gt;# Used just like it is used in PERL; comments out the remainder of the line after the # symbol.&lt;/p&gt;&lt;p&gt;// Used just like it is in JavaScript; comments out the remainder of the line after the // symbols.&lt;/p&gt;&lt;p&gt;/* and */— Comments out anything in between the two sets of symbols. This is the same syntax used in C to comment code.&lt;/p&gt;&lt;p&gt;Examples of comments in PHP code:&lt;/p&gt;&lt;p&gt;&amp;lt;? &lt;/p&gt;&lt;p&gt;echo "Hello"; #prints out "Hello"&lt;/p&gt;&lt;p&gt;echo "Hello"; //prints out "Hello"&lt;/p&gt;&lt;p&gt;/* The following&lt;/p&gt;&lt;p&gt;prints out "Hello" */&lt;/p&gt;&lt;p&gt;echo "Hello";&lt;/p&gt;&lt;p&gt;?&amp;gt;&lt;/p&gt;&lt;p&gt;You  will often see comments denoted using the // characters or the /* and  */ characters. The # character is rarely seen, although it is still  valid.&lt;/p&gt;&lt;br /&gt;                                   &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-7985782121685410074?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/7985782121685410074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/variables_13.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/7985782121685410074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/7985782121685410074'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/variables_13.html' title='Variables'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-3365712774428376032</id><published>2009-03-13T22:35:00.000-07:00</published><updated>2010-12-20T03:27:31.914-08:00</updated><title type='text'>PHP Strings</title><content type='html'>&lt;p&gt;String variables are used to store and manipulate a piece of text.&lt;/p&gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;$msg="Hello World";&lt;br /&gt;&lt;br /&gt;echo $msg;&lt;br /&gt;&lt;p&gt;?&amp;gt;&lt;/p&gt;&lt;p&gt;The output will be&lt;/p&gt;&lt;p&gt;Hello World&lt;br /&gt;&lt;br /&gt; &lt;strong&gt;The Concatenation Operator&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;Dot (.) is used as concatenation operator. To concatenate two variables together, use the dot (.) operator:&lt;br /&gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;$str1="Hello World";&lt;br /&gt;&lt;br /&gt;$str2="Adam";&lt;br /&gt;&lt;br /&gt;echo $ str1. " " . $ str2;&lt;br /&gt;&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Hello World Adam&lt;br /&gt;&lt;br /&gt; &lt;strong&gt;Length of a String:&lt;br /&gt;&lt;/strong&gt;The strlen() function is used to find the length of a string. &lt;/p&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;$string=”Hello World”;&lt;br /&gt;&lt;p&gt;echo strlen($string);&lt;/p&gt;&lt;p&gt;?&amp;gt;&lt;/p&gt;&lt;p&gt;Output will be&lt;/p&gt;&lt;p&gt;11&lt;/p&gt;&lt;p&gt;&lt;strong&gt;The strpos() function:&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;The strpos() function is used to search for a string or character within another string.&lt;br /&gt;If  the string is found in the string, this function will return the  position of the first match. If no match is found, it will return FALSE.&lt;br /&gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;echo strpos("Example of strops function","of");&lt;br /&gt;&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The output will be&lt;/p&gt;&lt;p&gt;8&lt;/p&gt;                                    &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-3365712774428376032?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/3365712774428376032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-strings.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/3365712774428376032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/3365712774428376032'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-strings.html' title='PHP Strings'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-3261805952350072653</id><published>2009-03-13T22:34:00.000-07:00</published><updated>2010-12-20T03:27:48.875-08:00</updated><title type='text'>Operators</title><content type='html'>Operators are used to  manipulate or perform operations on variables and values. There are  many operators used in PHP, we have separated them into the following  categories.&lt;br /&gt; &lt;ol&gt;&lt;li&gt;Assignment Operators&lt;br /&gt; &lt;/li&gt;&lt;br /&gt; &lt;li&gt;Arithmetic Operators&lt;br /&gt; &lt;/li&gt;&lt;br /&gt; &lt;li&gt;Comparison Operators&lt;br /&gt; &lt;/li&gt;&lt;br /&gt; &lt;li&gt;Logical Operators&lt;br /&gt; &lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;p&gt;&lt;strong&gt;Assignment Operators:&lt;/strong&gt;&lt;br /&gt;Assignment  operators are used to set a variable equal to a value or set a variable  to another variable's value. ‘=’ is used for assignment operator.&lt;/p&gt;&lt;br /&gt;&lt;strong&gt;Example:&lt;/strong&gt;$var = 23;&lt;br /&gt;$var2 = $var;&lt;br /&gt;&lt;table summary="" border="1" cellpadding="0" cellspacing="0" width="56%"&gt;&lt;tbody&gt; &lt;tr&gt;&lt;td valign="top" width="15%"&gt;&lt;strong&gt;Operator&lt;/strong&gt;&lt;/td&gt;&lt;td valign="top" width="39%"&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/td&gt;&lt;td valign="top" width="44%"&gt;&lt;strong&gt;Is The Same As&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;=&lt;/td&gt;&lt;td valign="top"&gt;a=b&lt;/td&gt;&lt;td valign="top"&gt;a=b&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;+=&lt;/td&gt;&lt;td valign="top"&gt;a+=b&lt;/td&gt;&lt;td valign="top"&gt;a=a+b&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;-=&lt;/td&gt;&lt;td valign="top"&gt;a-=b&lt;/td&gt;&lt;td valign="top"&gt;a=a-b&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;*=&lt;/td&gt;&lt;td valign="top"&gt;a*=b&lt;/td&gt;&lt;td valign="top"&gt;a=a*b&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;/=&lt;/td&gt;&lt;td valign="top"&gt;a/=b&lt;/td&gt;&lt;td valign="top"&gt;a=a/b&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;.=&lt;/td&gt; &lt;td valign="top"&gt;a.=b&lt;/td&gt;&lt;td valign="top"&gt;a=a.b&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td valign="top"&gt;%=&lt;/td&gt;&lt;td valign="top"&gt;a%=b&lt;/td&gt;&lt;td valign="top"&gt;a=a%b&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;strong&gt;Arithmetic Operators:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;table summary="" border="1" cellpadding="0" cellspacing="0" width="50%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" width="27%"&gt;&lt;strong&gt;Operator&lt;/strong&gt;&lt;/td&gt;&lt;td valign="top" width="72%"&gt;&lt;strong&gt;Function&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;+&lt;/td&gt;&lt;td valign="top"&gt;Addition&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;-&lt;/td&gt;&lt;td valign="top"&gt;Subtraction&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;*&lt;/td&gt;&lt;td valign="top"&gt;Multiplication&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;/&lt;/td&gt;&lt;td valign="top"&gt;Division&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;%&lt;/td&gt;&lt;td valign="top"&gt;Modulus (division remainder)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;++&lt;/td&gt;&lt;td valign="top"&gt;Increment&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;--&lt;/td&gt;&lt;td valign="top"&gt;Decrement&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;strong&gt;Comparison Operators:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;table summary="" border="1" cellpadding="0" cellspacing="0" width="442"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td valign="top"&gt;&lt;strong&gt;Operator&lt;/strong&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;strong&gt;Function   &lt;/strong&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td valign="top"&gt;== &lt;/td&gt;&lt;td valign="top"&gt;Equal To&lt;/td&gt;&lt;td valign="top"&gt;$x == $y&lt;/td&gt;&lt;td valign="top"&gt;false&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;!= &lt;/td&gt;&lt;td valign="top"&gt;Not Equal To&lt;/td&gt;&lt;td valign="top"&gt;$x != $y&lt;/td&gt;&lt;td valign="top"&gt;true&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;&amp;lt;&lt;br /&gt;&lt;/td&gt;&lt;td valign="top"&gt;Less Than&lt;/td&gt;&lt;td valign="top"&gt;$x &amp;lt; $y &lt;/td&gt;&lt;td valign="top"&gt;true&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;&amp;gt;&lt;/td&gt;&lt;td valign="top"&gt;Greater Than&lt;/td&gt;&lt;td valign="top"&gt;$x &amp;gt; $y &lt;/td&gt;&lt;td valign="top"&gt;false&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td valign="top"&gt;&amp;lt;= &lt;/td&gt;&lt;td valign="top"&gt;Less Than or Equal To&lt;/td&gt;&lt;td valign="top"&gt;$x &amp;lt;= $y &lt;/td&gt;&lt;td valign="top"&gt;true&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;&amp;gt;= &lt;/td&gt;&lt;td valign="top"&gt;Greater Than or Equal To&lt;/td&gt;&lt;td valign="top"&gt;$x &amp;gt;= $y &lt;/td&gt;&lt;td valign="top"&gt;false&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;strong&gt;Logical Operators:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;table summary="" border="1" cellpadding="0" cellspacing="0" width="59%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" width="15%"&gt;&lt;strong&gt;Operator&lt;/strong&gt;&lt;/td&gt;&lt;td valign="top" width="40%"&gt;&lt;strong&gt;Function&lt;/strong&gt;&lt;/td&gt;&lt;td valign="top" width="45%"&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td valign="top"&gt;&amp;amp;&amp;amp;&lt;/td&gt;&lt;td valign="top"&gt;and&lt;/td&gt;&lt;td valign="top"&gt;x=8 y=4&lt;br /&gt;(x &amp;lt; 10 &amp;amp;&amp;amp; y &amp;gt; 1) returns true&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top"&gt;||&lt;/td&gt;&lt;td valign="top"&gt;or&lt;/td&gt; &lt;td valign="top"&gt;x=12&lt;br /&gt;y=8&lt;br /&gt;(x&amp;gt;=5 || y&amp;lt;=5) returns true&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td valign="top"&gt;!&lt;/td&gt;&lt;td valign="top"&gt;not&lt;/td&gt;&lt;td valign="top"&gt;x=6&lt;br /&gt;y=3&lt;br /&gt;!(x==y) returns true&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;                                   &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-3261805952350072653?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/3261805952350072653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/operators.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/3261805952350072653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/3261805952350072653'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/operators.html' title='Operators'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-5665121905291242258</id><published>2009-03-13T22:33:00.000-07:00</published><updated>2010-12-20T03:28:09.490-08:00</updated><title type='text'>If…Else Statement</title><content type='html'>&lt;p&gt;One of the most common PHP  language constructs that you will encounter is the if…then statement.  The if…then statement allows you to evaluate an expression and then,  depending if it is true or not, take a course of action. For example:&lt;/p&gt;&lt;br /&gt;&lt;p&gt;$x = 1; &lt;/p&gt;if($x) {&lt;br /&gt;&lt;p&gt;      echo "True!";&lt;/p&gt;}&lt;br /&gt;&lt;p&gt;Since  $x = 1, then PHP interprets it in the context of the if statement to be  a boolean type. Since 1 = true, the if statements prints out the  message. Literally you can read it as "If True, then print out "True!".&lt;/p&gt;Another example, but this time with an "else" clause:&lt;br /&gt;&lt;p&gt;$a = 5; &lt;/p&gt;$b = "10";&lt;br /&gt;&lt;p&gt;if($a &amp;gt; $b) {&lt;/p&gt;    echo "$a is greater than $b";&lt;br /&gt;&lt;p&gt;} else {&lt;/p&gt;    echo "$a is not greater than $b";&lt;br /&gt;&lt;p&gt;}&lt;/p&gt;&lt;br /&gt;PHP  doesn't care that $a is an integer and $b is a string. It recognizes  that $b also makes a pretty good integer as well. It then evaluates the  expression, "If $a is greater than $b then print out that $a is greater  than $b; if not (else) then print out $a is not greater than $b." It's  also important to note that you don't say, "$a is less than $b," since  it is possible that $a could be equal to $b. If that is the case, then  the second part of the expression, the else statement, is the part that  runs.&lt;br /&gt;&lt;p&gt;Note the use of brackets to enclose the actions. Also note the lack of semicolons where the brackets are used.&lt;/p&gt;One final example is the if…elseif…else statement:&lt;br /&gt;&lt;p&gt;if($a == $b) { &lt;/p&gt;    // do something&lt;br /&gt;&lt;p&gt;} elseif ($a &amp;gt; $b) {&lt;/p&gt;    // do something else&lt;br /&gt;&lt;p&gt;} elseif($a &amp;lt; $b) {&lt;/p&gt;    // do yet something else&lt;br /&gt;&lt;p&gt;} else  {&lt;/p&gt;    // if nothing else we do this...&lt;br /&gt;&lt;p&gt;}&lt;/p&gt;&lt;span style="font-weight: bold;"&gt;Switch Statement:&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;The  Switch statement is used to perform one of several different actions  based on one of several different conditions. Switch statements allow  for additional evaluations of the data, even though one of the cases  may have been met. Switch statements can also save you from typing many  if…elseif…elseif… statements.&lt;br /&gt;&lt;br /&gt;Syntax:&lt;br /&gt;&lt;br /&gt;switch (expression)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;case label1:&lt;br /&gt;&lt;br /&gt;  Statement(s);&lt;br /&gt;&lt;br /&gt;  break; &lt;br /&gt;&lt;br /&gt;case label2:&lt;br /&gt;&lt;br /&gt;  Statement(s);&lt;br /&gt;&lt;br /&gt;  break;&lt;br /&gt;&lt;br /&gt;default:&lt;br /&gt;&lt;br /&gt;  Statement(s);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example:&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;$a = "100"; &lt;/p&gt;switch($a) {&lt;br /&gt;&lt;p&gt;    case(10):&lt;/p&gt;      echo "The value is 10";&lt;br /&gt;&lt;p&gt;      break;&lt;/p&gt;    case (100):&lt;br /&gt;&lt;p&gt;      echo "The value is 100&amp;lt;br&amp;gt;";&lt;/p&gt;    case (1000):&lt;br /&gt;&lt;p&gt;      echo "The value is 1000";&lt;/p&gt;      break;&lt;br /&gt;&lt;p&gt;    default:&lt;/p&gt;      echo "&amp;lt;p&amp;gt;Wrong Input";&lt;br /&gt;&lt;p&gt;}&lt;/p&gt;&lt;span style="font-weight: bold;"&gt;switch statements have four basic parts:&lt;/span&gt;&lt;br /&gt; &lt;ol&gt;&lt;li&gt;The  switch— The switch identifies what value or expression is going to be  evaluated in each of the cases. In the example above, you tell the  switch statement that you are going to evaluate the variable $a in the  subsequent cases.&lt;/li&gt;&lt;br /&gt; &lt;li&gt;The  case— The case statement evaluates the variable you passed from the  switch command. You can use case() the same way you'd use an if  statement. If the case holds true, then everything after the case  statement is executed, until the parser encounters a break command, at  which point execution stops and the switch is exited.&lt;/li&gt;&lt;br /&gt; &lt;li&gt;Breakpoints—  Defined by the break command, exit the parser from the switch.  Breakpoints are normally put after statements executed when a case() is  met.&lt;/li&gt;&lt;br /&gt; &lt;li&gt;Default— The  default is a special kind of case. It is executed if none of the other  case statements in the switch have been executed.&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;                                    &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-5665121905291242258?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/5665121905291242258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/ifelse-statement.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/5665121905291242258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/5665121905291242258'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/ifelse-statement.html' title='If…Else Statement'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-299761865973783509</id><published>2009-03-13T22:32:00.000-07:00</published><updated>2010-12-20T03:28:30.946-08:00</updated><title type='text'>PHP Loops</title><content type='html'>Loops are used to repeat  statement or block of statement more than one time. The idea of a loop  is to do something over and over again until the task has been  completed.&lt;br /&gt;&lt;p&gt;In PHP we have the following looping statements:&lt;br /&gt;&lt;br /&gt; &lt;strong&gt;For &lt;/strong&gt;&lt;strong&gt;Loop&lt;/strong&gt;&lt;strong&gt;:&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;For loops are useful constructions to loop through a finite set of data, such as data in an array. &lt;/p&gt;&lt;strong&gt;Syntax:&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;for ( initialization; conditional statement; increment/decrement){&lt;br /&gt;&lt;br /&gt;            statement(s);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt; &lt;ol&gt;&lt;li&gt;Initialization—You can pass in an already assigned variable or assign a value to the variable in the for statement.&lt;/li&gt;&lt;br /&gt; &lt;li&gt;The condition required to continue the for loop— The statements are executed until the given condition goes false.&lt;/li&gt;&lt;br /&gt; &lt;li&gt;Statement to modify the counter on each pass of the loop.&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;strong&gt;Example:&lt;br /&gt;&lt;/strong&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;for ($i=1; $i&amp;lt;=10; $i++)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;  echo "Hello World&amp;lt;br /&amp;gt;";&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;p&gt;?&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;strong&gt;Foreach Loop: &lt;/strong&gt;&lt;br /&gt;&lt;p&gt;Foreach loops allow you to quickly traverse through an array.&lt;/p&gt;&lt;p&gt;$array = array("name" =&amp;gt; "Jet", "occupation" =&amp;gt; "Bounty Hunter" ); &lt;/p&gt;&lt;p&gt;foreach ($array as $val) {&lt;/p&gt;&lt;p&gt;    echo "&amp;lt;P&amp;gt;$val";&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;br /&gt;&lt;strong&gt;Prints out:&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;&amp;lt;P&amp;gt;Jet&lt;/p&gt;&lt;p&gt;&amp;lt;P&amp;gt;Bounty Hunter&lt;/p&gt;&lt;p&gt;You can also use foreach loops to get the key of the values in the array:&lt;/p&gt;&lt;p&gt;foreach ($array as $key =&amp;gt; $val) { &lt;/p&gt;&lt;p&gt;    echo "&amp;lt;P&amp;gt;$key : $val";&lt;/p&gt;&lt;p&gt;}&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt; &lt;strong&gt;Prints out:&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&amp;lt;P&amp;gt;name : Jet&lt;/p&gt;&lt;p&gt;&amp;lt;P&amp;gt;occupation : Bounty Hunter&lt;/p&gt;&lt;strong&gt;While &lt;/strong&gt;&lt;strong&gt;Loop&lt;/strong&gt;&lt;strong&gt;:&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;While  loops are another useful construct to loop through data. While loops  continue to loop until the expression in the while loop evaluates to  false. A common use of the while loop is to return the rows in an array  from a result set. The while loop continues to execute until all of the  rows have been returned from the result set.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Syntax:&lt;br /&gt;&lt;/strong&gt;while (condition){&lt;br /&gt;&lt;br /&gt;statement(s);&lt;br /&gt;&lt;/p&gt;&lt;p&gt;}&lt;br /&gt;&lt;br /&gt; &lt;strong&gt;Example:&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;$i=1;&lt;br /&gt;&lt;br /&gt;while($i&amp;lt;=9)&lt;br /&gt;&lt;br /&gt;  {&lt;br /&gt;&lt;br /&gt;  echo "The number is " . $i . "&amp;lt;br /&amp;gt;";&lt;br /&gt;&lt;br /&gt;  $i++;&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;/p&gt;&lt;p&gt;?&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Do-While Loop:&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Do  while loops are another useful loop construct. Do while loops work  exactly the same as normal while loops, except that the script  evaluates the while expression after the loop has completed, instead of  before the loop executes, as in a normal while loop.&lt;/p&gt;&lt;p&gt;The  important difference between a do while loop and a normal while loop is  that a do while loop is always executed at least once. A normal while  loop may not be executed at all, depending on the expression. The  following do while loop is executed one time, printing out $i to the  screen:&lt;/p&gt;&lt;p&gt;$i = 0; &lt;/p&gt;&lt;p&gt;do {&lt;/p&gt;&lt;p&gt;   print $i;&lt;/p&gt;&lt;p&gt;} while ($i&amp;gt;0);&lt;/p&gt;&lt;p&gt;Whereas the following is not executed at all:&lt;/p&gt;&lt;p&gt;$i = 0; &lt;/p&gt;&lt;p&gt;while($i &amp;gt; 0)  {&lt;/p&gt;&lt;p&gt;print $i;&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;strong&gt;Arrays:&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;An  array is a data structure that stores one or more values in a single  value. PHP supports both numerical arrays (array items are indexed by  their numerical order) as well as associative arrays (array items are  indexed by named keys).&lt;/p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;$a = array(1, 2, 3, 4); &lt;/p&gt;&lt;p&gt;//$a[0] = 1&lt;/p&gt;&lt;p&gt;//$a[1] = 2&lt;/p&gt;&lt;p&gt;//$a[2] = 3&lt;/p&gt;&lt;p&gt;//$a[3] = 4&lt;/p&gt;&lt;p&gt;$b = array("name"=&amp;gt;"Fred", "age" =&amp;gt; 30);&lt;/p&gt;&lt;p&gt;//$b['name'] = "Fred"&lt;/p&gt;&lt;p&gt;//$b['age'] = 30&lt;/p&gt;                                    &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbila&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-299761865973783509?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/299761865973783509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-loops.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/299761865973783509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/299761865973783509'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-loops.html' title='PHP Loops'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-278792912682070510</id><published>2009-03-13T22:31:00.000-07:00</published><updated>2010-12-20T03:28:51.023-08:00</updated><title type='text'>PHP Functions</title><content type='html'>&lt;p&gt;In addition to PHP's built-in  functions, you can create your own functions. Remember that if you want  to use variables that exist outside of the function, then you must  declare them as global variables or assign them as arguments to the  function itself.&lt;/p&gt;&lt;p&gt;function check_age($age) { &lt;/p&gt;&lt;p&gt;    if ($age &amp;gt; 21) {&lt;/p&gt;&lt;p&gt;        return 1;&lt;/p&gt;&lt;p&gt;    } else {&lt;/p&gt;&lt;p&gt;        return 0;&lt;/p&gt;&lt;p&gt;    }&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;//usage:&lt;/p&gt;&lt;p&gt;if(check_age($age)) {&lt;/p&gt;&lt;p&gt;    echo "You may enter!";&lt;/p&gt;&lt;p&gt;} else {&lt;/p&gt;&lt;p&gt;    echo "Access Not Allowed!";&lt;/p&gt;&lt;p&gt;    exit();&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;The function would be called from within your script at the appropriate time, using the following syntax:&lt;/p&gt;&lt;p&gt;$age = 10; &lt;/p&gt;&lt;p&gt;check_age($age);&lt;br /&gt; &lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;function simpletable($text) {&lt;br /&gt;&lt;br /&gt;  print("&amp;lt;table border=0 cellpadding=0 cellspacing=0&amp;gt;&amp;lt;tr&amp;gt;");&lt;br /&gt;&lt;br /&gt;  print("&amp;lt;td&amp;gt;$text&amp;lt;/td&amp;gt;");&lt;br /&gt;&lt;br /&gt;  print("&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;"); &lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;phpinfo( )&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;phpinfo()  is a very useful function that allows you to see what version of PHP is  running on your Web server, as well as all of the specific settings  that are enabled in that version.&lt;/p&gt;&lt;p&gt;&amp;lt;? &lt;/p&gt;&lt;p&gt;    phpinfo();&lt;/p&gt;&lt;p&gt;?&amp;gt;&lt;/p&gt;                                    &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-278792912682070510?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/278792912682070510/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/278792912682070510'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/278792912682070510'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-functions.html' title='PHP Functions'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-8466334671386704304</id><published>2009-03-13T22:30:00.000-07:00</published><updated>2010-12-20T03:29:24.598-08:00</updated><title type='text'>PHP Forms</title><content type='html'>&lt;p&gt;&lt;br /&gt;Forms are the most fundamental  method of interaction for your users. Users must use a form to enter  information into a site. Think about it, every bulletin board, shopping  cart, feedback form, and poll is a type of form. Without forms, the Web  is nothing more than a publishing medium for those who can FTP Web  pages up to a server.&lt;br /&gt;&lt;strong&gt;GET &amp;amp; POST Methods:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;There are two methods that you can use when creating a form in HTML. They are post and get, as in:&lt;/p&gt;&amp;lt;form action=”saveinfo.php” method=post&amp;gt;&lt;br /&gt;&lt;p&gt;or:&lt;/p&gt;&amp;lt;form action=”saveinfo.php” method=get&amp;gt;&lt;br /&gt;&lt;p&gt;If  you don't specify a method, then the Web server assumes that you are  using the get method. So what's the deal? They do the same thing right?  Well, almost. You may have noticed that the URL looks a lot longer  after you submit a form that uses the get method. For example, you may  see something like:&lt;/p&gt;http://studiesinn.com/form.php?name=fred&amp;amp;age=20&amp;amp;comments=This+site+rocks&lt;br /&gt;&lt;p&gt;That's  because the get method puts the contents of the form right in the URL.  There are a few disadvantages to this. First, depending on your Web  server's operating system and software, there is a limit to how much  data you can send through a form using the get method. On many systems,  this limit is 256 characters. Also, the individual get queries may be  stored in your Web server logs. If you are using space on a shared  server, then other people may be able to decipher data sent from your  forms that use the get method.&lt;/p&gt;The  post method was created to correct the inadequacies of the get method.  The information sent using the post method is not visible in the URL,  and form data cannot be deciphered by looking in the Web server logs.  There also isn't such a small limit on the amount of data that can be  sent from a form. Again, it depends on your server, but you probably  won't ever hit the limit of sending data using the post method for a  text-based form.&lt;br /&gt;&lt;p&gt;I  use the post method for my scripts unless I need to debug something.  When you need to debug something on a form, it is easy enough to switch  to the get method (by changing the action line in your script) and then  check the URL after you submit your buggy form. You can usually pick up  typos and such with a quick look.&lt;br /&gt;&lt;br /&gt;   &lt;strong&gt;Example:&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&amp;lt;form action="display.php" method="get"&amp;gt;&lt;br /&gt;&lt;br /&gt;Name: &amp;lt;input type="text" name="name" /&amp;gt;&lt;br /&gt;&lt;br /&gt;Age: &amp;lt;input type="text" name="age" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;input type="submit" /&amp;gt;&lt;br /&gt;&lt;/p&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;p&gt;When you click the "Submit" button on the form the URL sent could look something like this:&lt;br /&gt;&lt;br /&gt; http://www.studiesinn.com/display.php?name=adam&amp;amp;age=22&lt;br /&gt;&lt;br /&gt;On display.php page you can retrieve the value by using the following code&lt;br /&gt;&lt;br /&gt;Welcome &amp;lt;?php echo $_GET["name"]; ?&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;&lt;br /&gt;You are &amp;lt;?php echo $_GET["age"]; ?&amp;gt; years old!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The $_REQUEST Variable:&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;The PHP $_REQUEST variable can be used as the replacement of  $_GET,  $_POST, and $_COOKIE. The $_REQUEST variable can be used to get the  result from form data sent with both the GET and POST methods.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;&amp;lt;form action="display.php" method="post"&amp;gt;&lt;br /&gt;&lt;br /&gt;Enter your name: &amp;lt;input type="text" name="name" /&amp;gt;&lt;br /&gt;&lt;br /&gt;Enter your age: &amp;lt;input type="text" name="age" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;input type="submit" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;/p&gt;When you click the Submit button on the form, following URL will be sent.&lt;br /&gt;&lt;p&gt;http://www.studiesinn.com/display.php&lt;/p&gt;&lt;p&gt;On display.php page you can retrieve the value as&lt;/p&gt;&lt;p&gt;Welcome &amp;lt;?php echo $_POST["name"]; ?&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;&lt;br /&gt; You are &amp;lt;?php echo $_POST["age"]; ?&amp;gt; years old!&lt;br /&gt;&lt;/p&gt;                                    &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-8466334671386704304?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/8466334671386704304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-forms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/8466334671386704304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/8466334671386704304'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-forms.html' title='PHP Forms'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-7828812228475844970</id><published>2009-03-13T22:29:00.000-07:00</published><updated>2010-12-20T03:29:40.134-08:00</updated><title type='text'>PHP Sessions</title><content type='html'>&lt;p&gt;&lt;br /&gt;You cannot track variables across a user session unless you start the session on each page on which you want to use or alter those  variables. Starting a session uses the session_start() function:&lt;/p&gt;&lt;p&gt;session_start(); &lt;/p&gt;session_start()  takes no arguments. If you are starting a new session, then the  function initializes the session and creates the necessary temp files  to track the session. If a $PHPSESSID is found by the function, either  by a cookie or a GET variable, then the function resumes the current  session and the page has access to any variables that have been  registered to the session.&lt;br /&gt;&lt;p&gt;Once  you have started the session, you need to register some variables with  it. The session will not track variables until they have been  registered using the session_register() function:&lt;/p&gt;session_register(STRING);&lt;br /&gt;&lt;p&gt;&lt;br /&gt;The  STRING argument to session_register() should be the name of the  variable that you want to register with the session so that it may be  accessed across any session-enabled pages.&lt;/p&gt;Once  you have started the session and registered one or more variables, you  can use those variables across any session enabled pages on your site.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;&amp;lt;?&lt;/p&gt;&lt;p&gt;session_start();&lt;/p&gt;&lt;p&gt;if(!isset($count)) {&lt;/p&gt;&lt;p&gt;session_register("count");&lt;/p&gt;&lt;p&gt;     $count = 1;&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;?&amp;gt;&lt;/p&gt;&lt;p&gt;You have been to this page &amp;lt;?=$count?&amp;gt; times.&lt;/p&gt;&lt;p&gt;&amp;lt;?&lt;/p&gt;&lt;p&gt;$count++;&lt;/p&gt;&lt;p&gt;?&amp;gt;&lt;strong&gt;&lt;br /&gt;&lt;br /&gt; Destroying Sessions:&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;There  are two ways to combat the buildup of files in your temporary directory  that will not, in most cases, adversely affect your users' sessions.&lt;/p&gt;&lt;p&gt;The first is to make use of the session_destroy() function:&lt;/p&gt;&lt;p&gt;session_destroy(); &lt;/p&gt;&lt;p&gt;session_destroy()  takes no arguments. session_destroy() unregisters all session variables  associated with the user session and removes any session files created  by the session. Remember that even if a variable is unregistered with a  session, the variable still exists with its value intact on the current  page.&lt;/p&gt;                                    &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-7828812228475844970?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/7828812228475844970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-sessions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/7828812228475844970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/7828812228475844970'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-sessions.html' title='PHP Sessions'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-8139207753337462691</id><published>2009-03-13T22:28:00.000-07:00</published><updated>2010-12-20T03:29:57.484-08:00</updated><title type='text'>PHP Cookies</title><content type='html'>A cookie is a small bit of  information stored on a viewer's computer by his or her web browser by  request from a web page. The information is constantly passed in HTTP  headers between the browser and web server; the browser sends the  current cookie as part of its request to the server and the server  sends updates to the data back to the user as part of its response. In  addition to the information it stores, each cookie has a set of  attributes: an expiration date, a valid domain, a valid domain path and  an optional security flag. These attributes help ensure the browser  sends the correct cookie when a request is made to a server.&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Syntax:&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;setcookie(name, value, expire, path, domain);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;setcookie("c_name", "Adam", time()+60);&lt;br /&gt;&lt;p&gt;?&amp;gt;&lt;strong&gt;&lt;br /&gt;&lt;br /&gt;Retrieve a Cookie:&lt;/strong&gt;&lt;br /&gt;The $_COOKIE variable is used to retrieve a cookie. &lt;/p&gt;&lt;p&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt; echo $_COOKIE["user"];&lt;/p&gt;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                                   &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-8139207753337462691?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/8139207753337462691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-cookies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/8139207753337462691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/8139207753337462691'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-cookies.html' title='PHP Cookies'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-332752306612330567</id><published>2009-03-13T22:27:00.000-07:00</published><updated>2010-12-20T03:31:12.453-08:00</updated><title type='text'>PHP Files</title><content type='html'>&lt;p&gt;PHP is a very useful language  for working with files. Although it may not be as robust as other  languages, such as PERL, when it comes to parsing files, PHP still  provides great power and flexibility when it comes to working with text  files.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Opening a File:&lt;br /&gt;&lt;/strong&gt;Before you can use PHP to read a file, you must first open it. To open a file, you use the fopen() function.&lt;/p&gt;&lt;p&gt;$file_handler = fopen($file, $mode) &lt;/p&gt;&lt;p&gt;You  must assign the function to a variable, as above. This is referred to  as a file pointer. You use the file pointer to reference the open file  throughout your script.&lt;/p&gt;&lt;p&gt;The fopen() function takes two arguments:&lt;br /&gt; &lt;/p&gt;&lt;ul&gt;&lt;li&gt;$file is the name (and path, if required) of the file.&lt;/li&gt;&lt;br /&gt; &lt;li&gt;$mode is one of a list of available modes:&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;1.        r— Open the file as read-only. You cannot write anything to the file. Reading begins at the beginning of the file.&lt;br /&gt;&lt;p&gt;2.        r+  — Open the file for reading and writing. Reading and writing begin at  the beginning of the file. You will delete existing contents if you  write to the file without first moving the internal pointer to the end  of the file.&lt;/p&gt;3.        w—  Open the file for write-only. You cannot read data from the file.  Writing begins at the beginning of the file. You will again delete  contents if you write to the file without first moving the pointer to  the end of the file. If the file specified by the $fie argument does  not exist, then PHP attempts to create the file. Make sure your  permissions are set correctly!&lt;br /&gt;&lt;p&gt;4.        w+ — As above, but the file may also be read.&lt;/p&gt;5.        a—  This mode is the same as the 'w' mode, with the exception that the  internal pointer is placed at the end of the file. Existing contents  will not be overwritten unless you rewind the internal pointer to the  beginning of the file.&lt;br /&gt;&lt;p&gt;6.        a+ — As above, but the file may also be read.&lt;/p&gt;Additionally,  if the file is a binary file, you must include a "b" in the mode if  your OS is Windows. This chapter only deals with ASCII text files, so  you will not require the "b: mode in the following example. If you do  need to open a binary file, an example is below:&lt;br /&gt;&lt;p&gt;$file_handle = fopen($filename, "rb+") &lt;/p&gt;Note  the differences between the "w" and "a" modes. Using "w" to open a file  effectively deletes the contents of the file, while using the "a" mode  retains the contents of the file and allows you to append additional  data to the end of the file.&lt;br /&gt;&lt;p&gt;Once you have the file opened, you can then read from or write to the file.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Reading a File:&lt;/strong&gt;There are mult&lt;br /&gt;                                   &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-332752306612330567?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/332752306612330567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-files.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/332752306612330567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/332752306612330567'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-files.html' title='PHP Files'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-2140738374948399988</id><published>2009-03-13T22:26:00.000-07:00</published><updated>2010-12-20T03:31:29.677-08:00</updated><title type='text'>E-mail</title><content type='html'>&lt;p&gt;mail() function is used to send emails from inside a script in php. The Syntax of mail() function is as under.mail(to,subject,message,headers,parameters)&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;table summary="" border="1" cellpadding="0" cellspacing="0" width="440"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td valign="top" width="70"&gt;&lt;strong&gt;Parameter&lt;/strong&gt;&lt;/td&gt;&lt;td valign="top" width="674"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;to&lt;/td&gt;&lt;td valign="top"&gt;Required. Specifies the receivers email&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;subject&lt;/td&gt;&lt;td valign="top"&gt;Required. Specifies the subject of the email&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;message&lt;/td&gt;&lt;td valign="top"&gt;Required.  Contain the message to be sent. Each line should be separated with a  Line Fed (\n). Lines should not exceed 70 characters&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;headers&lt;/td&gt;&lt;td valign="top"&gt;Optional. Specifies additional headers, like From, Cc, and Bcc. The additional headers should be separated with a CRLF (\r\n)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;parameters&lt;/td&gt;&lt;td valign="top"&gt;Optional. Specifies an additional parameter to the sendmail program.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;&amp;lt;?php&lt;br /&gt;$to      = 'noname@testing.com';&lt;br /&gt;&lt;br /&gt;$subject = 'E-mail subject';&lt;br /&gt;&lt;br /&gt;$message = 'E-mail message';&lt;br /&gt;&lt;br /&gt;$headers = 'From: webmaster@studiesinn.com' . "\r\n" .&lt;br /&gt;&lt;br /&gt;    'Reply-To: webmaster@ webmaster.com' . "\r\n" .&lt;br /&gt;&lt;br /&gt;    'X-Mailer: PHP/' . phpversion();&lt;br /&gt;&lt;br /&gt;mail($to, $subject, $message, $headers);&lt;br /&gt;&lt;br /&gt;?&amp;gt;&lt;/p&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-2140738374948399988?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/2140738374948399988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/e-mail.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/2140738374948399988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/2140738374948399988'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/e-mail.html' title='E-mail'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-4656587292842522536</id><published>2009-03-13T22:23:00.000-07:00</published><updated>2010-12-20T03:32:17.884-08:00</updated><title type='text'>Error Handling</title><content type='html'>&lt;span style=";font-family:Arial;font-size:12;"  &gt;&lt;br /&gt;Error handling is the process of changing the control flow of a program in response to error conditions. Error conditions can be caused by a  variety of factors - programmer error, corrupt input data, software  requirements deficiencies and in many other conditions.&lt;br /&gt;A  web application needs to be able to gracefully handle all of these  potential problems - recovering from them where possible and exiting  gracefully when the error is fatal.&lt;br /&gt;&lt;br /&gt;We will show different error handling methods:&lt;ol&gt;&lt;li&gt;Simple "die()" statements&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Custom errors and error triggers&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Error reporting&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;strong&gt;Simple die() statement:&lt;/strong&gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;if(!file_exists("myfile.txt"))&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;die("File not found");&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;$file=fopen("myfile.txt","r");&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;p&gt;?&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;If the file does not exist you get an error message like this:&lt;/p&gt;&lt;p&gt;File not found&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Custom errors and error triggers &lt;/strong&gt;&lt;/p&gt;&lt;p&gt;You can create a custom error handler in PHP to replace the standard output to the  browser. First you set up the error handler to replace the normal one,  and set the ini values.&lt;/p&gt;&lt;p&gt;ini_set('display_errors', 'Off');&lt;/p&gt;&lt;p&gt;ini_set('log_errors', 'On');&lt;/p&gt;&lt;p&gt;define('ERROR_LOG_PATH', 'error_log.txt'); &lt;/p&gt;&lt;p&gt;set_error_handler("custom_err_handler");&lt;/p&gt;&lt;p&gt;The custom function is defined we must then create it. The function takes 4 arguments.&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;strong&gt;$num:&lt;/strong&gt; level of the error raised&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;$str:&lt;/strong&gt; contains the error message&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;$file:&lt;/strong&gt; filename that the error was raised in&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;$line:&lt;/strong&gt; line number the error was raised at&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;function custom_err_handler($num, $str, $file, $line) {&lt;/p&gt;&lt;p&gt;    print "Error Handler Called!";&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;    $err = "";&lt;/p&gt;&lt;p&gt;    $err .= "PHP Error\n";&lt;/p&gt;&lt;p&gt;    $err .= "Number: [" . $num . "]\n";&lt;/p&gt;&lt;p&gt;    $err .= "String: [" . $str . "]\n";&lt;/p&gt;&lt;p&gt;    $err .= "File: [" . $file . "]\n";&lt;/p&gt;&lt;p&gt;    $err .= "Line: [" . $line . "]\n\n";&lt;/p&gt;&lt;p&gt;    error_log($err, 3, ERROR_LOG_PATH);&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;function Errfunction() {&lt;/p&gt;&lt;p&gt;            trigger_error("errror message");&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;Now call the Errfunction() &lt;/p&gt;&lt;p&gt;myFunction();&lt;/p&gt;&lt;/span&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-4656587292842522536?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/4656587292842522536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/error-handling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/4656587292842522536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/4656587292842522536'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/error-handling.html' title='Error Handling'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-9099731317868016635</id><published>2009-03-13T22:22:00.000-07:00</published><updated>2010-12-20T03:33:08.272-08:00</updated><title type='text'>File Upload</title><content type='html'>&lt;p&gt;&lt;br /&gt;You must first build an HTML form that lets users select a file to upload.&lt;/p&gt;&lt;p&gt;&amp;lt;form enctype="multipart/form-data" action="uploadfile.php" method="POST"&amp;gt;&lt;br /&gt;&lt;br /&gt;Select file to upload: &amp;lt;input name="file" type="file" /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;input type="submit" value="Upload File" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;uploadfile.php code:&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;$target_path = "myfiles/";&lt;br /&gt;&lt;br /&gt;$target_path = $target_path . basename( $_FILES[‘file’]['name']);&lt;br /&gt;&lt;br /&gt;if(move_uploaded_file($_FILES[‘file’]['tmp_name'], $target_path)) {&lt;br /&gt;&lt;br /&gt;   echo "The file ".  basename( $_FILES[‘file’]['name'])." has been uploaded";&lt;br /&gt;&lt;br /&gt;} else{&lt;br /&gt;&lt;br /&gt;   echo "Error Uploading File, Please try again.";&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;$_FILES['file']['name']&lt;/strong&gt;&lt;br /&gt;It contains the original path of the user uploaded file.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;$_FILES['file']['tmp_name'] &lt;/strong&gt;&lt;/p&gt;It  contains the path to the temporary file that resides on the server. The  file should exist on the server in a temporary directory with a  temporary name.&lt;br /&gt;&lt;p&gt;&lt;strong&gt;The include() Function:&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;The include() function takes all the text in a specified file and copies it into the file that uses the include function.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example:&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;?php include("header.php"); ?&amp;gt;&lt;br /&gt;&amp;lt;h1&amp;gt;Welcome to The Home Page&amp;lt;/h1&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-9099731317868016635?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/9099731317868016635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/file-upload.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/9099731317868016635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/9099731317868016635'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/file-upload.html' title='File Upload'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-494145656216064121</id><published>2009-03-13T22:21:00.000-07:00</published><updated>2009-03-15T08:57:31.991-07:00</updated><title type='text'>PHP Databases</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;A database is a collection  of data that is stored independently of the manner in which you collect  it or may wish to retrieve it.  It is organized for efficient storage  and retrieval, based on the nature of the data, rather than the  collection or retrieval methods.&lt;br /&gt;&lt;strong&gt;What is MySQL&lt;br /&gt;&lt;/strong&gt;MySQL  is an open source relational database management system (RDBMS)that  uses Structured Query Language (SQL), the most popular language for  adding, accessing, and processing data in a database. It is a Database  Management System which is available for both Linux and Windows.&lt;br /&gt;&lt;p&gt;In a database, there are tables. Database tables contain rows, columns, and cells. Tables are used to organize and group your data by common characteristics or principles.&lt;br /&gt;&lt;strong&gt;Database Query:&lt;/strong&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;Database  Query is a form generator and query manager that works with any  database. Database Query automatically creates forms for selecting,  updating, inserting, or deleting data in MySQL, Oracle, DB2, or any  other database. With MySQL, we can query a database for specific  information and have a recordset returned.&lt;/p&gt;                                    &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-494145656216064121?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/494145656216064121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-databases.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/494145656216064121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/494145656216064121'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/php-databases.html' title='PHP Databases'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-7340020465510744714</id><published>2009-03-13T22:20:00.000-07:00</published><updated>2009-03-15T08:58:12.039-07:00</updated><title type='text'>Connecting to a MySQL Database</title><content type='html'>&lt;p&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;In order to pull information from a MySQL database to your php pages, you need to connect to the database first.&lt;br /&gt;&lt;strong&gt;Syntax&lt;/strong&gt;:&lt;br /&gt;mysql_connect(servername,username,password);&lt;br /&gt;&lt;strong&gt;servername:&lt;/strong&gt; It specifies the server to connect to. Default value is "localhost:3306"&lt;br /&gt;&lt;strong&gt;username:&lt;/strong&gt; It specifies the username to log in with. Default value is the name of the user that owns the server process&lt;br /&gt;&lt;strong&gt;password:&lt;/strong&gt; It specifies the password to login. Default is ""&lt;/p&gt;&lt;strong&gt;Note:&lt;br /&gt;&lt;/strong&gt;To  execute the SQL statements we must use the mysql_query() function. This  function is used to send a query or command to a MySQL connection.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example:&lt;br /&gt;&lt;/strong&gt;&amp;lt;?php&lt;br /&gt;&lt;!--p &lt;br--&gt;$server = "localhost";&lt;br /&gt;$user = "";&lt;br /&gt;$pass = "";&lt;br /&gt;$db = "mydb";&lt;br /&gt;&lt;p&gt;$conn = mysql_connect("$host", "$user", "$pass") or die ("Unable to connect.");&lt;br /&gt;mysql_select_db("$db", $conn);&lt;/p&gt;?&amp;gt;&lt;br /&gt;&lt;strong&gt;Create a Database&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;PHP also provide a function to create MySQL database, mysql_create_db(). &lt;/p&gt;&lt;!--p&lt;br--&gt;$con = mysql_connect("localhost:3306","adam","123456");&lt;br /&gt;if (!$con)&lt;br /&gt;  {&lt;br /&gt;  die('Could not connect: ' . mysql_error());&lt;br /&gt;  }&lt;br /&gt;$query  = "CREATE DATABASE mydb";&lt;br /&gt;$result = mysql_query($query,$con);&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;Create a Table&lt;/strong&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;p&gt;CREATE TABLE statement is used to create a database table in MySQL database.&lt;!--p&lt;br--&gt;&lt;br /&gt;&lt;/p&gt;$con = mysql_connect("localhost:3306","adam","123456");&lt;br /&gt;if (!$con)&lt;br /&gt;  {&lt;br /&gt;  die('Could not connect: ' . mysql_error());&lt;br /&gt;&lt;p&gt;  }&lt;/p&gt;mysql_select_db("mydb", $con);&lt;br /&gt;mysql_query("CREATE TABLE emp_info(&lt;br /&gt;emp_id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id),Emp_name VARCHAR(30),&lt;br /&gt;Emp_age INT)")&lt;br /&gt; or die(mysql_error()); &lt;br /&gt;echo "Table Created";&lt;br /&gt;&lt;p&gt;?&amp;gt;&lt;/p&gt;                                    &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-7340020465510744714?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/7340020465510744714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/connecting-to-mysql-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/7340020465510744714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/7340020465510744714'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/connecting-to-mysql-database.html' title='Connecting to a MySQL Database'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-4776103504336486907</id><published>2009-03-13T22:15:00.001-07:00</published><updated>2009-03-15T08:59:17.670-07:00</updated><title type='text'>MySQL Data Types</title><content type='html'>&lt;strong&gt;Numeric Data Types:&lt;/strong&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;table summary="" border="1" cellpadding="0" cellspacing="0" width="457"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" width="104"&gt;TINYINT( )&lt;/td&gt;&lt;td valign="top" width="393"&gt;-128 to 127 normal 0 to 255 UNSIGNED.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;SMALLINT( )&lt;/td&gt;&lt;td valign="top"&gt;-32768 to 32767 normal 0 to 65535 UNSIGNED.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;MEDIUMINT( )&lt;/td&gt;&lt;td valign="top"&gt;-8388608 to 8388607 normal 0 to 16777215 UNSIGNED.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;INT( )&lt;/td&gt;&lt;td valign="top"&gt;-2147483648 to 2147483647 normal 0 to 4294967295 UNSIGNED.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;BIGINT( )&lt;/td&gt;&lt;td valign="top"&gt;-9223372036854775808 to 9223372036854775807 normal 0 to 18446744073709551615 UNSIGNED.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;FLOAT&lt;/td&gt;&lt;td valign="top"&gt;A small number with a floating decimal point.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;DOUBLE( , )&lt;/td&gt;&lt;td valign="top"&gt;A large number with a floating decimal point.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;DECIMAL( , )&lt;/td&gt;&lt;td valign="top"&gt;A DOUBLE stored as a string, allowing for a fixed decimal point.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;strong&gt;TEXT TYPES&lt;/strong&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;table summary="" border="1" cellpadding="0" cellspacing="0" width="456"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td valign="top" width="105"&gt;CHAR( )&lt;/td&gt;&lt;td valign="top" width="345"&gt;Fixed section from 0 to 255 characters long.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;VARCHAR( )&lt;/td&gt;&lt;td valign="top"&gt;Variable section from 0 to 255 characters long.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;TINYTEXT&lt;/td&gt;&lt;td valign="top"&gt;String with a maximum length of 255 characters.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;TEXT&lt;/td&gt;&lt;td valign="top"&gt;String with a maximum length of 65535 characters.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;BLOB&lt;/td&gt;&lt;td valign="top"&gt;String with a maximum length of 65535 characters.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;MEDIUMTEXT&lt;br /&gt;&lt;/td&gt;&lt;td valign="top"&gt;String with a maximum length of 16777215 characters.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;MEDIUMBLOB&lt;/td&gt;&lt;td valign="top"&gt;String with a maximum length of 16777215 characters.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;LONGTEXT&lt;/td&gt;&lt;td valign="top"&gt;String with a maximum length of 294967295 characters.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;LONGBLOB&lt;br /&gt;&lt;/td&gt;&lt;td valign="top"&gt;String with a maximum length of 4294967295 characters.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;strong&gt;Date Data Types:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;table summary="" border="1" cellpadding="0" cellspacing="0" width="383"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td valign="top" width="89"&gt;DATE&lt;/td&gt;&lt;td valign="top" width="188"&gt;YYYY-MM-DD.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;DATETIME&lt;/td&gt;&lt;td valign="top"&gt;YYYY-MM-DD H:MM:SS.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;TIMESTAMP&lt;/td&gt;&lt;td valign="top"&gt;YYYYMMDDHHMMSS.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;TIME&lt;/td&gt;&lt;td valign="top"&gt;HH:MM:SS.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;strong&gt;MISC Types&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;table summary="" border="1" cellpadding="0" cellspacing="0" width="385"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" width="69"&gt;ENUM ( )&lt;/td&gt;&lt;td valign="top" width="310"&gt;ENUMERATION means that each column may have one of specified possible values.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;SET&lt;/td&gt;&lt;td valign="top"&gt;SET is similar to ENUM. However, SET can have up to 64 list items and it can store more than one choice&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;                                    &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-4776103504336486907?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/4776103504336486907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/mysql-data-types.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/4776103504336486907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/4776103504336486907'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/mysql-data-types.html' title='MySQL Data Types'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-7077675798205948333</id><published>2009-03-13T22:14:00.001-07:00</published><updated>2009-03-15T08:59:50.905-07:00</updated><title type='text'>Inserting Data Into a Table</title><content type='html'>&lt;p&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;The INSERT INTO SQL statement impregnates our table with data. Here is a general form of INSERT.&lt;/p&gt;INSERT INTO table_name (column1, column2....) VALUES (value1, value2,....)&lt;br /&gt;&lt;p&gt;&amp;lt;?php&lt;br /&gt;$con = mysql_connect("localhost:3306","adam","123456");&lt;br /&gt;if (!$con)&lt;br /&gt;{&lt;br /&gt;die('Could not connect: ' . mysql_error());&lt;br /&gt;}&lt;/p&gt;mysql_select_db("mydb", $con);&lt;br /&gt;mysql_query("INSERT INTO empinfo (FirstName, LastName, Age)&lt;br /&gt;VALUES ('Adam', 'John', '22')");&lt;br /&gt;mysql_close($con);&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-7077675798205948333?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/7077675798205948333/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/inserting-data-into-table.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/7077675798205948333'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/7077675798205948333'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/inserting-data-into-table.html' title='Inserting Data Into a Table'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-8626146738587662815</id><published>2009-03-13T22:12:00.000-07:00</published><updated>2009-03-15T09:00:20.385-07:00</updated><title type='text'>Select Statement</title><content type='html'>&lt;p&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;The select query is used to retrieve records from a database. &lt;/p&gt;&lt;table summary="" border="1" cellpadding="0" cellspacing="0" width="397"&gt;&lt;tbody&gt;  &lt;tr&gt;    &lt;td valign="top" width="96"&gt;SELECT&lt;/td&gt;    &lt;td valign="top" width="295"&gt;Retrieves fields from one or more tables.&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;    &lt;td valign="top"&gt;FROM&lt;/td&gt; &lt;td valign="top"&gt;Tables containing the fields.&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;   &lt;td valign="top"&gt;WHERE&lt;/td&gt;  &lt;td valign="top"&gt;Criteria to restrict the records returned.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;  &lt;td valign="top"&gt;GROUP BY&lt;/td&gt;  &lt;td valign="top"&gt;Determines how the records should be grouped.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;  &lt;td valign="top"&gt;HAVING&lt;/td&gt; &lt;td valign="top"&gt;Used with GROUP BY to specify the criteria for the grouped records.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td valign="top"&gt;ORDER BY&lt;/td&gt;&lt;td valign="top"&gt;Criteria for ordering the records.&lt;/td&gt;&lt;/tr&gt;  &lt;tr&gt; &lt;td valign="top"&gt;LIMIT&lt;/td&gt;&lt;td valign="top"&gt;Limit the number of records returned.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;SELECT column_name(s)&lt;br /&gt;FROM table_name&lt;br /&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;&lt;p&gt; &lt;/p&gt;&amp;lt;?php&lt;br /&gt;$con = mysql_connect("localhost:3306","adam","123456");&lt;br /&gt;if (!$con)&lt;br /&gt;{&lt;br /&gt;die('Could not connect: ' . mysql_error());&lt;br /&gt;}&lt;br /&gt;mysql_select_db("mydb", $con);&lt;br /&gt;$result = mysql_query("SELECT * FROM empinfo");&lt;br /&gt;while($row = mysql_fetch_array($result))&lt;br /&gt;{&lt;br /&gt;echo $row['FirstName'] . " " . $row['LastName'] . “ “ $row[‘Age’];&lt;br /&gt;echo "&amp;lt;br /&amp;gt;";&lt;br /&gt;}&lt;br /&gt;mysql_close($con);&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;p&gt;Returned  data from mysql_query() function will be stored in the result variable.  msql_fetch_array() function is used to return the first row from the  recordset as an array. The while loop loops through all the records in  the recordset and retrieve all the records from the recordset.&lt;/p&gt;&lt;br /&gt;Following function can be used in the select statement.&lt;br /&gt;&lt;table summary="" border="1" cellpadding="0" cellspacing="0" width="382"&gt; &lt;tbody&gt;&lt;tr&gt;    &lt;td valign="top" width="65"&gt;&lt;strong&gt;Function&lt;/strong&gt;&lt;/td&gt; &lt;td valign="top" width="317"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top"&gt;AVG()&lt;/td&gt; &lt;td valign="top"&gt;Returns the average value in a group of records. &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;  &lt;td valign="top"&gt;COUNT()&lt;/td&gt;  &lt;td valign="top"&gt;Returns the number of records in a group of records&lt;/td&gt;   &lt;/tr&gt; &lt;tr&gt; &lt;td valign="top"&gt;MAX()&lt;/td&gt;&lt;td valign="top"&gt;Returns the largest value in a group of records.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td valign="top"&gt;MIN()&lt;/td&gt;&lt;td valign="top"&gt;Returns the lowest value in a group of records &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td valign="top"&gt;SUM()&lt;/td&gt;&lt;td valign="top"&gt;Returns the sum of a field. &lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;strong&gt;Display the Result in an HTML Table&lt;br /&gt;&lt;/strong&gt;&lt;p&gt;&amp;lt;?php&lt;br /&gt;$con = mysql_connect("localhost:3306","adam","123456");&lt;br /&gt;if (!$con)&lt;br /&gt;{&lt;br /&gt;die('Could not connect: ' . mysql_error());&lt;br /&gt;&lt;/p&gt;}&lt;br /&gt;mysql_select_db("mydb", $con);&lt;br /&gt;&lt;p&gt;result = mysql_query("SELECT * FROM empinfo");&lt;br /&gt;&lt;br /&gt;echo "&amp;lt;table border='1' align=’center’&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Firstname&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Lastname&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;/p&gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Age&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;";&lt;br /&gt;while($row = mysql_fetch_array($result))&lt;br /&gt;{&lt;br /&gt;echo "&amp;lt;tr&amp;gt;";&lt;br /&gt;echo "&amp;lt;td&amp;gt;" . $row['FirstName'] . "&amp;lt;/td&amp;gt;";&lt;br /&gt;&lt;p&gt;  echo "&amp;lt;td&amp;gt;" . $row['LastName'] . "&amp;lt;/td&amp;gt;";&lt;/p&gt;echo "&amp;lt;td&amp;gt;" . $row['Age'] . "&amp;lt;/td&amp;gt;";&lt;br /&gt;&lt;br /&gt;echo "&amp;lt;/tr&amp;gt;";&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;echo "&amp;lt;/table&amp;gt;";&lt;br /&gt;mysql_close($con);&lt;br /&gt;&lt;p&gt;?&amp;gt;&lt;/p&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-8626146738587662815?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/8626146738587662815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/select-statement.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/8626146738587662815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/8626146738587662815'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/select-statement.html' title='Select Statement'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-6675532782767083315</id><published>2009-03-13T22:11:00.000-07:00</published><updated>2009-03-15T09:01:01.079-07:00</updated><title type='text'>Where Clause</title><content type='html'>&lt;p&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;In Select Query we use WHERE clause to select only data that matches a specified criteria. &lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Syntax&lt;/strong&gt;&lt;br /&gt;SELECT column(s) FROM tablename WHERE column operator value&lt;br /&gt;&lt;strong&gt;Example:&lt;br /&gt;&lt;/strong&gt;&lt;strong&gt;Table Name(&lt;/strong&gt;empinfo&lt;strong&gt;)&lt;/strong&gt;&lt;/p&gt;&lt;table summary="" border="1" cellpadding="0" width="431"&gt; &lt;tbody&gt;  &lt;tr&gt;&lt;td width="71"&gt;&lt;strong&gt;FirstName&lt;/strong&gt;&lt;/td&gt;&lt;td width="70"&gt;&lt;strong&gt;LastName      &lt;/strong&gt;&lt;/td&gt;&lt;td width="194"&gt;&lt;strong&gt;Email&lt;/strong&gt;&lt;/td&gt; &lt;td width="76"&gt;&lt;strong&gt;DOB &lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Steve&lt;/td&gt;&lt;td&gt;Martin&lt;/td&gt;&lt;td&gt;smart.steve@studiesinn.com&lt;/td&gt;&lt;td&gt;08-04-1988&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;David&lt;/td&gt;   &lt;td&gt;Fernandas&lt;/td&gt;&lt;td&gt;davidfernandas@studiesinn.com&lt;/td&gt; &lt;td&gt;04-16-1977&lt;/td&gt;&lt;/tr&gt;   &lt;tr&gt;&lt;td&gt;Ajay&lt;/td&gt;&lt;td&gt;Rathor&lt;/td&gt;&lt;td&gt;ajayrathor@studiesinn.com&lt;/td&gt;&lt;td&gt;08-24-1986&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;$con = mysql_connect("localhost:3306","adam","123456");&lt;br /&gt;if (!$con)&lt;br /&gt;  {&lt;br /&gt;  die('Could not connect: ' . mysql_error());&lt;br /&gt;&lt;p&gt;  }&lt;/p&gt;mysql_select_db("mydb", $con);&lt;br /&gt;$result = mysql_query("SELECT * FROM empinfo where FirstName=’David’");&lt;br /&gt;while($row = mysql_fetch_array($result))&lt;br /&gt;  {&lt;br /&gt;  echo $row['FirstName'] . " " . $row['LastName'] . “ “ $row[‘DOB’];&lt;br /&gt;  echo "&amp;lt;br /&amp;gt;";&lt;br /&gt;  }&lt;br /&gt;mysql_close($con);&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;p&gt;Output will be.&lt;/p&gt;David Fernandas 04-16-1977&lt;br /&gt;&lt;strong&gt;Operator that can be used in where clause are as under&lt;/strong&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;= Equal&lt;br /&gt;!= Not equal&lt;br /&gt;&amp;gt; Greater than&lt;br /&gt;&amp;lt; Less than&lt;br /&gt;&amp;gt;= Greater than or equal&lt;br /&gt;&amp;lt;= Less than or equal&lt;br /&gt;BETWEEN Between an inclusive range&lt;br /&gt;LIKE Search for a pattern&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-6675532782767083315?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/6675532782767083315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/where-clause.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/6675532782767083315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/6675532782767083315'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/where-clause.html' title='Where Clause'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-8433423473761330363</id><published>2009-03-13T22:09:00.000-07:00</published><updated>2009-03-15T09:01:43.315-07:00</updated><title type='text'>Order By</title><content type='html'>&lt;p&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;We use Order By Keyword to sort the records in a recordset. The general syntax is as under. &lt;/p&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;SELECT columnname(s) FROM tablename ORDER BY columnname SortOrder&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Example:&lt;br /&gt;Table Name(&lt;/strong&gt;empinfo&lt;strong&gt;)&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&lt;table summary="" border="1" cellpadding="0" width="431"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td width="71"&gt;&lt;strong&gt;FirstName&lt;/strong&gt;&lt;/td&gt; &lt;td width="70"&gt;&lt;strong&gt;LastName&lt;/strong&gt;&lt;/td&gt;     &lt;td width="194"&gt;&lt;strong&gt;Email &lt;/strong&gt;&lt;/td&gt;  &lt;td width="76"&gt;&lt;strong&gt;DOB&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td&gt;Steve&lt;/td&gt;&lt;td&gt;Martin&lt;/td&gt;&lt;td&gt;smart.steve@studiesinn.com&lt;/td&gt;&lt;td&gt;08-04-1988&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;David&lt;/td&gt;&lt;td&gt;Fernandas&lt;/td&gt;&lt;td&gt;davidfernandas@studiesinn.com&lt;/td&gt;&lt;td&gt;04-16-1977&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Ajay&lt;/td&gt;&lt;td&gt;Rathor&lt;/td&gt;&lt;td&gt;ajayrathor@studiesinn.com&lt;/td&gt;&lt;td&gt;08-24-1986&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;?php&lt;br /&gt;&lt;p&gt;$con = mysql_connect("localhost:3306","adam","123456");&lt;br /&gt;if (!$con)&lt;br /&gt;  {&lt;br /&gt;  die('Could not connect: ' . mysql_error());&lt;br /&gt;&lt;/p&gt;&lt;p&gt;  }&lt;/p&gt;mysql_select_db("mydb", $con);&lt;br /&gt;$result = mysql_query("SELECT * FROM empinfo order by FirstName asc");&lt;br /&gt;while($row = mysql_fetch_array($result))&lt;br /&gt;  {&lt;br /&gt;  echo $row['FirstName'] . " " . $row['LastName'] . “ “ $row[‘DOB];&lt;br /&gt;  echo "&amp;lt;br /&amp;gt;";&lt;br /&gt;  }&lt;br /&gt;mysql_close($con);&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;p&gt;The Output will be&lt;br /&gt;Ajay Rathor 08-24-1986&lt;br /&gt;David Fernandas 04-16-1977&lt;br /&gt;Steve Martin 08-04-1988&lt;br /&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;br /&gt;SortOrder is optional if you does not use it the records will be sorted in ascending order (1 to 10 or a to z).  Use  DESC as SortOrder to sort records in descending order. RAND() is used  for random sort. SQL statements are not case sensitive. You can use  both capital letters and small letter.&lt;br /&gt;&lt;/p&gt;                                    &lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-8433423473761330363?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/8433423473761330363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/order-by.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/8433423473761330363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/8433423473761330363'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/order-by.html' title='Order By'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-3215622748140353359</id><published>2009-03-13T22:03:00.001-07:00</published><updated>2009-03-15T09:02:09.699-07:00</updated><title type='text'>Update Statement</title><content type='html'>&lt;p&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;Update statement is used to modify the data in a database table. The general syntax is as under. &lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Syntax&lt;/strong&gt;&lt;br /&gt;UPDATE tablename SET columnname = newvalue WHERE columnname = value&lt;br /&gt;&lt;strong&gt;Example:&lt;br /&gt;&lt;/strong&gt;&lt;strong&gt;Table Name(&lt;/strong&gt;empinfo&lt;strong&gt;)&lt;/strong&gt;&lt;/p&gt;&lt;table summary="" border="1" cellpadding="0" width="431"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td width="71"&gt;&lt;strong&gt;FirstName&lt;/strong&gt;&lt;/td&gt;&lt;td width="70"&gt;&lt;strong&gt;LastName&lt;/strong&gt;&lt;/td&gt;      &lt;td width="194"&gt;&lt;strong&gt;Email&lt;/strong&gt;&lt;/td&gt;&lt;td width="76"&gt;&lt;strong&gt;DOB&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Steve&lt;br /&gt;&lt;/td&gt;&lt;td&gt;Martin&lt;/td&gt;&lt;td&gt;smart.steve@studiesinn.com&lt;/td&gt;&lt;td&gt;08-04-1988&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;David&lt;/td&gt;&lt;td&gt;Fernandas&lt;/td&gt;&lt;td&gt;davidfernandas@studiesinn.com&lt;/td&gt;&lt;td&gt;04-16-1977&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Ajay&lt;/td&gt;&lt;td&gt;Rathor&lt;/td&gt;&lt;td&gt;ajayrathor@studiesinn.com&lt;/td&gt;&lt;td&gt;08-24-1986&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;$con = mysql_connect("localhost:3306","adam","123456");&lt;br /&gt;if (!$con)&lt;br /&gt;{&lt;br /&gt;die('Could not connect: ' . mysql_error());&lt;br /&gt;&lt;p&gt;  }&lt;/p&gt;mysql_select_db("mydb", $con);&lt;br /&gt;$result = mysql_query("Update empinfo Set DOB=’07-05-1988’ where FirstName=’Steve’");&lt;br /&gt;mysql_close($con);&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;table summary="" border="1" cellpadding="0" width="431"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td width="71"&gt;&lt;strong&gt;FirstName&lt;/strong&gt;&lt;/td&gt;&lt;td width="70"&gt;&lt;strong&gt;LastName&lt;/strong&gt;&lt;/td&gt;&lt;td width="194"&gt;&lt;strong&gt;Email&lt;/strong&gt;&lt;/td&gt;&lt;td width="76"&gt;&lt;strong&gt;DOB&lt;/strong&gt;&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Steve&lt;/td&gt;&lt;td&gt;Martin&lt;/td&gt;&lt;td&gt;smart.steve@studiesinn.com&lt;/td&gt;&lt;td&gt;07-05-1988&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;David&lt;/td&gt;&lt;td&gt;Fernandas&lt;/td&gt;&lt;td&gt;davidfernandas@studiesinn.com&lt;/td&gt;&lt;td&gt;04-16-1977&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Ajay&lt;/td&gt;&lt;td&gt;Rathor&lt;/td&gt;&lt;td&gt;ajayrathor@studiesinn.com&lt;/td&gt;&lt;td&gt;08-24-1986&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt; &lt;/p&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-3215622748140353359?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/3215622748140353359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/variables.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/3215622748140353359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/3215622748140353359'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/variables.html' title='Update Statement'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8095570854804033541.post-3425235350348296238</id><published>2009-03-13T22:01:00.000-07:00</published><updated>2009-03-15T09:02:36.666-07:00</updated><title type='text'>Delete From Statement</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;DELETE FROM statement is used to delete rows from a database table. The general syntax is as under.&lt;p&gt;&lt;strong&gt;Syntax&lt;/strong&gt;&lt;br /&gt;DELETE FROM tablename WHERE columnname = value&lt;/p&gt;&lt;span style="font-weight: bold;"&gt;Example:&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Table Name(&lt;/strong&gt;empinfo&lt;strong&gt;)&lt;/strong&gt;&lt;table border="1" cellpadding="0" cellspacing="0" width="421"&gt;    &lt;tbody&gt;&lt;tr&gt;    &lt;td width="71"&gt;&lt;strong&gt;FirstName&lt;/strong&gt;&lt;/td&gt;    &lt;td width="70"&gt;&lt;strong&gt;LastName&lt;/strong&gt;&lt;/td&gt;    &lt;td width="194"&gt;&lt;strong&gt;Email&lt;/strong&gt;&lt;/td&gt;&lt;td width="76"&gt;&lt;strong&gt;DOB    &lt;/strong&gt;&lt;/td&gt; &lt;/tr&gt;  &lt;tr&gt;    &lt;td&gt;Steve&lt;/td&gt;    &lt;td&gt;Martin&lt;/td&gt;  &lt;td&gt;smart.steve@studiesinn.com&lt;/td&gt;    &lt;td&gt;08-04-1988&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;    &lt;td&gt;David&lt;/td&gt;    &lt;td&gt;Fernandas&lt;/td&gt;    &lt;td&gt;davidfernandas@studiesinn.com&lt;/td&gt;    &lt;td&gt;04-16-1977&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;    &lt;td&gt;Ajay&lt;/td&gt;    &lt;td&gt;Rathor&lt;/td&gt;  &lt;td&gt;ajayrathor@studiesinn.com&lt;/td&gt;    &lt;td&gt;08-24-1986&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;$con = mysql_connect("localhost:3306","adam","123456");&lt;br /&gt;if (!$con)&lt;br /&gt;{&lt;br /&gt;die('Could not connect: ' . mysql_error());&lt;br /&gt;&lt;p&gt;  }&lt;/p&gt;mysql_select_db("mydb", $con);&lt;br /&gt;$result = mysql_query("Delete From empinfo  where FirstName=’Steve’");&lt;br /&gt;mysql_close($con);&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;google_ad_client = "pub-0657137394626876"; google_ad_slot = "5170633839";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;table border="1" cellpadding="0" width="420"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td width="71"&gt;&lt;strong&gt;FirstName&lt;/strong&gt;&lt;/td&gt;&lt;td width="70"&gt;&lt;strong&gt;LastName&lt;/strong&gt;&lt;/td&gt;      &lt;td width="194"&gt;&lt;strong&gt;Email&lt;/strong&gt;&lt;/td&gt;&lt;td width="76"&gt;&lt;strong&gt;DOB&lt;/strong&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;David&lt;/td&gt;&lt;td&gt;Fernandas&lt;/td&gt;&lt;td&gt;davidfernandas@studiesinn.com&lt;/td&gt;  &lt;td&gt;04-16-1977&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Ajay&lt;/td&gt;&lt;td&gt;Rathor&lt;/td&gt;&lt;td&gt;ajayrathor@studiesinn.com&lt;/td&gt;&lt;td&gt;08-24-1986&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt; &lt;/p&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8095570854804033541-3425235350348296238?l=phptutorialshub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phptutorialshub.blogspot.com/feeds/3425235350348296238/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/introduction.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/3425235350348296238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8095570854804033541/posts/default/3425235350348296238'/><link rel='alternate' type='text/html' href='http://phptutorialshub.blogspot.com/2009/03/introduction.html' title='Delete From Statement'/><author><name>Malik</name><uri>http://www.blogger.com/profile/13602544266228369990</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
