<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Internet Marketing, Web Technologies &#38; News - Best Web Ezy &#187; PHP MySQL</title>
	<atom:link href="http://www.bestwebezy.com/category/php-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bestwebezy.com</link>
	<description>Internet marketing and web design information provided by Best Web Ezy.  All kinds of information about the web - reviews, online marketing, SEO, email marketing, web design &#38; development and latest web technologies can be found here!</description>
	<lastBuildDate>Thu, 02 Feb 2012 09:45:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PHP Session Problem</title>
		<link>http://www.bestwebezy.com/php-mysql/php-session-problem/</link>
		<comments>http://www.bestwebezy.com/php-mysql/php-session-problem/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 07:55:51 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[PHP MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php session]]></category>

		<guid isPermaLink="false">http://www.bestwebezy.com/?p=367</guid>
		<description><![CDATA[If you wrote websites in PHP, you would very likely be using PHP Session. Using PHP session allows you to preserve certain data across subsequent accesses.  Visitor of your site would be assigned a unique session id and would be propagated throughout his / her browsing session. However, a lot of inexperienced PHP programmers would [...]]]></description>
			<content:encoded><![CDATA[<p>If you wrote websites in PHP, you would very likely be using PHP Session. Using PHP session allows you to preserve certain data across subsequent accesses.  Visitor of your site would be assigned a unique session id and would be propagated throughout his / her browsing session.</p>
<p>However, a lot of inexperienced PHP programmers would have problems using it.  They might find it difficult to carry the session id to the other pages, or simply, no session id assigned.</p>
<p>A quick checklist if you face this issue:</p>
<ol>
<li>Make sure &lt;?php session_start(); ?&gt; is at the very first line of the page</li>
<li>Check your php.ini file and make sure session.use_only_cookies=1</li>
</ol>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark to</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-session-problem%2Ftitle=PHP+Session+Problem" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-session-problem%2Ftitle=PHP+Session+Problem" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-session-problem%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurlbm_url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-session-problem%2Fbm_description=PHP+Session+Problem" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.newsvine.com/_wine/save?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-session-problem%2Fh=PHP+Session+Problem" rel="nofollow" title="Add to&nbsp;Newsvine"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/newsvine.png" title="Add to&nbsp;Newsvine" alt="Add to&nbsp;Newsvine" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-session-problem%2Ftitle=PHP+Session+Problem" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.squidoo.com/lensmaster/bookmark?http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-session-problem%2F" rel="nofollow" title="Add to&nbsp;Squidoo"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/squidoo.png" title="Add to&nbsp;Squidoo" alt="Add to&nbsp;Squidoo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-session-problem%2Ft=PHP+Session+Problem" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.bestwebezy.com/php-mysql/php-session-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP/MySQL Tutorial Part 4 &#8211; Retrieve Data</title>
		<link>http://www.bestwebezy.com/php-mysql/phpmysql-tutorial-part-4-retrieve-data/</link>
		<comments>http://www.bestwebezy.com/php-mysql/phpmysql-tutorial-part-4-retrieve-data/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 16:20:58 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[PHP MySQL]]></category>
		<category><![CDATA[php mysql tutorial]]></category>
		<category><![CDATA[php retreive mysql]]></category>

		<guid isPermaLink="false">http://www.bestwebezy.com/?p=255</guid>
		<description><![CDATA[To retrieve after inserting them (see older post PHP/MySQL Tutorial Part 3), simply select the record from the desired table.  Use this SQL statement: SELECT * FROM table_name; Eg. $result = mysql_query(&#8220;SELECT * FROM tablename&#8221;); $row = mysql_fetch_assoc($result); while($row = mysql_fetch_assoc($result)) { echo $row['name']; echo &#8220;-&#8221;; echo $row['email']; } This would display: Terence &#8211; terence@someemail.com [...]]]></description>
			<content:encoded><![CDATA[<p>To retrieve after inserting them (see older post <a href="http://www.bestwebezy.com/php-mysql/phpmysql-tutorial-part-3-insert-records/">PHP/MySQL Tutorial Part 3</a>), simply select the record from the desired table.  Use this SQL statement:</p>
<p>SELECT * FROM table_name;</p>
<p>Eg.<br />
$result = mysql_query(&#8220;SELECT * FROM tablename&#8221;);<br />
$row = mysql_fetch_assoc($result);<br />
while($row = mysql_fetch_assoc($result))<br />
{<br />
echo $row['name'];<br />
echo &#8220;-&#8221;;<br />
echo $row['email'];<br />
}</p>
<p>This would display:</p>
<p>Terence &#8211; terence@someemail.com<br />
Johnny &#8211; johnny@otheremail.com</p>
<p>You can control the results with varying the statement. Eg.</p>
<p>SELECT name FROM tablename &#8211; retreives the name column only<br />
SELECT * FROM tablename ORDER BY id DESC &#8211; shows last record first<br />
SELECT * FROM tablename LIMIT 5 &#8211; shows the first 5 results only</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark to</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-4-retrieve-data%2Ftitle=PHP%2FMySQL+Tutorial+Part+4+%26%238211%3B+Retrieve+Data" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-4-retrieve-data%2Ftitle=PHP%2FMySQL+Tutorial+Part+4+%26%238211%3B+Retrieve+Data" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-4-retrieve-data%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurlbm_url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-4-retrieve-data%2Fbm_description=PHP%2FMySQL+Tutorial+Part+4+%26%238211%3B+Retrieve+Data" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.newsvine.com/_wine/save?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-4-retrieve-data%2Fh=PHP%2FMySQL+Tutorial+Part+4+%26%238211%3B+Retrieve+Data" rel="nofollow" title="Add to&nbsp;Newsvine"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/newsvine.png" title="Add to&nbsp;Newsvine" alt="Add to&nbsp;Newsvine" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-4-retrieve-data%2Ftitle=PHP%2FMySQL+Tutorial+Part+4+%26%238211%3B+Retrieve+Data" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.squidoo.com/lensmaster/bookmark?http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-4-retrieve-data%2F" rel="nofollow" title="Add to&nbsp;Squidoo"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/squidoo.png" title="Add to&nbsp;Squidoo" alt="Add to&nbsp;Squidoo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-4-retrieve-data%2Ft=PHP%2FMySQL+Tutorial+Part+4+%26%238211%3B+Retrieve+Data" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.bestwebezy.com/php-mysql/phpmysql-tutorial-part-4-retrieve-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP/MySQL Tutorial Part 3 &#8211; Insert Records</title>
		<link>http://www.bestwebezy.com/php-mysql/phpmysql-tutorial-part-3-insert-records/</link>
		<comments>http://www.bestwebezy.com/php-mysql/phpmysql-tutorial-part-3-insert-records/#comments</comments>
		<pubDate>Sun, 08 Feb 2009 14:40:57 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[PHP MySQL]]></category>
		<category><![CDATA[php delete mysql]]></category>
		<category><![CDATA[php insert mysql]]></category>
		<category><![CDATA[php mysql tutorial]]></category>
		<category><![CDATA[php update mysql]]></category>

		<guid isPermaLink="false">http://www.bestwebezy.com/?p=254</guid>
		<description><![CDATA[After connecting to the database (see older post PHP/MySQL Tutorial Part 2), the next step would probably be inserting data into it. It is actually pretty simple.  The steps are: 1. Connect to the database 2. Select the right table 3. put the data in You would need to setup a form on your website.  Let&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>After connecting to the database (see older post <a href="http://www.bestwebezy.com/php-mysql/phpmysql-tutorial-part-2-connect-to-database/">PHP/MySQL Tutorial Part 2</a>), the next step would probably be inserting data into it.</p>
<p>It is actually pretty simple.  The steps are:</p>
<p>1. Connect to the database<br />
2. Select the right table<br />
3. put the data in</p>
<p>You would need to setup a form on your website.  Let&#8217;s start with a simple one which contains name and email addresses only.  Use &#8220;POST&#8221; and when the form is submitted, send the data to &#8220;insert.php&#8221;.</p>
<p>And in insert.php, first use &#8220;POST&#8221; to gather the data, then use the following SQL statement:</p>
<p><span class="re0">$sql</span> = <span class="st0">&#8220;INSERT INTO table_name (name,email) VALUES ($name, $email)&#8221;</span>;<br />
<span class="re0">$result</span> = <span class="kw3">mysql_query</span><span class="br0">(</span><span class="re0">$sql</span><span class="br0">)</span>;</p>
<p>That&#8217;s done.  Simple is it?</p>
<p> </p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark to</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-3-insert-records%2Ftitle=PHP%2FMySQL+Tutorial+Part+3+%26%238211%3B+Insert+Records" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-3-insert-records%2Ftitle=PHP%2FMySQL+Tutorial+Part+3+%26%238211%3B+Insert+Records" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-3-insert-records%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurlbm_url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-3-insert-records%2Fbm_description=PHP%2FMySQL+Tutorial+Part+3+%26%238211%3B+Insert+Records" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.newsvine.com/_wine/save?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-3-insert-records%2Fh=PHP%2FMySQL+Tutorial+Part+3+%26%238211%3B+Insert+Records" rel="nofollow" title="Add to&nbsp;Newsvine"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/newsvine.png" title="Add to&nbsp;Newsvine" alt="Add to&nbsp;Newsvine" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-3-insert-records%2Ftitle=PHP%2FMySQL+Tutorial+Part+3+%26%238211%3B+Insert+Records" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.squidoo.com/lensmaster/bookmark?http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-3-insert-records%2F" rel="nofollow" title="Add to&nbsp;Squidoo"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/squidoo.png" title="Add to&nbsp;Squidoo" alt="Add to&nbsp;Squidoo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-3-insert-records%2Ft=PHP%2FMySQL+Tutorial+Part+3+%26%238211%3B+Insert+Records" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.bestwebezy.com/php-mysql/phpmysql-tutorial-part-3-insert-records/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP/MySQL Tutorial Part 2 &#8211; Connect to Database</title>
		<link>http://www.bestwebezy.com/php-mysql/phpmysql-tutorial-part-2-connect-to-database/</link>
		<comments>http://www.bestwebezy.com/php-mysql/phpmysql-tutorial-part-2-connect-to-database/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 13:19:41 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[PHP MySQL]]></category>
		<category><![CDATA[connect mysql]]></category>
		<category><![CDATA[connect to database]]></category>
		<category><![CDATA[php connect mysql]]></category>
		<category><![CDATA[php mysql tutorial]]></category>

		<guid isPermaLink="false">http://www.bestwebezy.com/?p=248</guid>
		<description><![CDATA[After you have verified that your server supports PHP (see older post PHP/MySQL Tutorial Part 1), you can go ahead to create a database, and connect to it.  Usually Linux server packages comes with tools like cPanel, where you can create a database, a user and a password on a web interface.  It is relatively [...]]]></description>
			<content:encoded><![CDATA[<p>After you have verified that your server supports PHP (see older post <a title="PHP/MySQL Tutorial Part 1" href="http://www.bestwebezy.com/php-mysql/php-mysql-tutorial-part-1php-mysql-tutorial-part-1" target="_blank">PHP/MySQL Tutorial Part 1</a>), you can go ahead to create a database, and connect to it.  Usually Linux server packages comes with tools like cPanel, where you can create a database, a user and a password on a web interface.  It is relatively simple, and hence we are not going to discuss it here.</p>
<p>To connect to a database, you would need to know:</p>
<p>1. Host address &#8211; 95% is &#8216;localhost&#8217; but sometimes it can be different.  Eg. for <a href="http://www.ipower.com/join/index.bml?AffID=574690" target="_blank">iPower</a>, it should be &#8216;username.ipowermysql.com&#8217;.<br />
2. Database name<br />
3. A username<br />
4. A password</p>
<p>It is easier to start with a code snippet:</p>
<p>&lt;?php<br />
$dbhost = &#8216;localhost&#8217;;<br />
$dbname = &#8216;databasename&#8217;;<br />
$dbuser = &#8216;username&#8217;;<br />
$dbpass = &#8216;password&#8217;;</p>
<p>$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (&#8216;Error connecting to database&#8217;);</p>
<p>mysql_select_db($dbname);<br />
?&gt;</p>
<p>The first part of the code specifies the host address, username and password of the database.  The second part basically connects to the database.  If it failed, it would output &#8216;Error connecting to database&#8217;.</p>
<p>The last line of the code simply selects the database to connect to.</p>
<p>It is also a good idea to close the connection after any operation is done.  Use this code:</p>
<p>&lt;?php</p>
<p>mysql_close($conn);<br />
?&gt;</p>
<p>Usually we would put the first code in a file named &#8216;connect.php&#8217; or &#8216;config.php&#8217;, and include it at the beginning of the file.  At the end of the file, we would include the last code which is saved in a file named &#8216;close.php&#8217;.</p>
<p>Disclosure: We are compensated for our reviews. <a href="http://www.ipower.com/affiliate/ftc-disclosure.bml" target="_blank">Click here</a> for details.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark to</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-2-connect-to-database%2Ftitle=PHP%2FMySQL+Tutorial+Part+2+%26%238211%3B+Connect+to+Database" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-2-connect-to-database%2Ftitle=PHP%2FMySQL+Tutorial+Part+2+%26%238211%3B+Connect+to+Database" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-2-connect-to-database%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurlbm_url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-2-connect-to-database%2Fbm_description=PHP%2FMySQL+Tutorial+Part+2+%26%238211%3B+Connect+to+Database" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.newsvine.com/_wine/save?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-2-connect-to-database%2Fh=PHP%2FMySQL+Tutorial+Part+2+%26%238211%3B+Connect+to+Database" rel="nofollow" title="Add to&nbsp;Newsvine"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/newsvine.png" title="Add to&nbsp;Newsvine" alt="Add to&nbsp;Newsvine" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-2-connect-to-database%2Ftitle=PHP%2FMySQL+Tutorial+Part+2+%26%238211%3B+Connect+to+Database" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.squidoo.com/lensmaster/bookmark?http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-2-connect-to-database%2F" rel="nofollow" title="Add to&nbsp;Squidoo"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/squidoo.png" title="Add to&nbsp;Squidoo" alt="Add to&nbsp;Squidoo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphpmysql-tutorial-part-2-connect-to-database%2Ft=PHP%2FMySQL+Tutorial+Part+2+%26%238211%3B+Connect+to+Database" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.bestwebezy.com/php-mysql/phpmysql-tutorial-part-2-connect-to-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP/MySQL Tutorial Part 1</title>
		<link>http://www.bestwebezy.com/php-mysql/php-mysql-tutorial-part-1/</link>
		<comments>http://www.bestwebezy.com/php-mysql/php-mysql-tutorial-part-1/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 15:03:13 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[PHP MySQL]]></category>
		<category><![CDATA[php mysql tutorial]]></category>

		<guid isPermaLink="false">http://www.bestwebezy.com/?p=246</guid>
		<description><![CDATA[I started using PHP with MySQL a few years ago.  I found that the world of PHP has no limit at all!  You can pretty much do anything you want. And because it is so large, people start telling me &#8220;I bought a book because I want to learn PHP.  But I just have no [...]]]></description>
			<content:encoded><![CDATA[<p>I started using PHP with MySQL a few years ago.  I found that the world of PHP has no limit at all!  You can pretty much do anything you want.</p>
<p>And because it is so large, people start telling me &#8220;I bought a book because I want to learn PHP.  But I just have no clue of where to start.&#8221;. </p>
<p>The most important feature that PHP provides is its robustness when it comes to interacting with the database.  And yet, this is always the most desirable feature used getting to web programming.</p>
<p>Hence I am writing this tutorial.  I am sure you can find millions of similar tutorials on the internet.  But well, doesn&#8217;t hurt to have another one.</p>
<p>First of all, what sites would need a database?</p>
<ul>
<li>Forums</li>
<li>Blogs</li>
<li>Shopping sites</li>
<li>Banners</li>
</ul>
<p>After all, these sites only do a few actions &#8211; add information, read information, edit information, and delete information to or from the database.  Hence my conclusion is: you need to learn how to add/read/edit/delete to start with.</p>
<p>Anything else needed?  Yes, and I have listed them below:</p>
<ul>
<li>A Linux server with Apache installed, OR</li>
<li>A linux hosting account.  You can get one cheaply with a domain name <a title="Reliable Linux Server" href="http://ads.bestwebezy.com/www/delivery/ck.php?oaparams=2__bannerid=4__zoneid=9__cb=a8602fe705__maxdest=http://www.ipower.com/join/index.bml?AffID=574690&amp;LinkName=bestwebezy" target="_blank">here</a>.  Obviously this is the easier option.</li>
<li>A computer with notepad or any other text editor.  However, do not use Word to edit codes.  It is going to give you a lot of headache if you do.  If you are going to program a complete website with proper layout etc, I would recommend <span style="text-decoration: line-through;">Macromedia</span> Adobe Dreamweaver.</li>
<li>A file transfer program like WS_FTP or Filezilla. </li>
</ul>
<p>Are you sure you have everything ready?  Go on and test it by placing this code into an empty file:</p>
<p>&lt;?php<br />
phpinfo();<br />
?&gt;</p>
<p>Save the file as phpinfo.php.  Try to access this page with a browser &#8211; if things go well, you would see a page with the information of the server.  And you have already written your first line of PHP code!</p>
<p>Disclosure: We are compensated for our reviews. <a href="http://www.ipower.com/affiliate/ftc-disclosure.bml" target="_blank">Click here</a> for details.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark to</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-mysql-tutorial-part-1%2Ftitle=PHP%2FMySQL+Tutorial+Part+1" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-mysql-tutorial-part-1%2Ftitle=PHP%2FMySQL+Tutorial+Part+1" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-mysql-tutorial-part-1%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurlbm_url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-mysql-tutorial-part-1%2Fbm_description=PHP%2FMySQL+Tutorial+Part+1" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.newsvine.com/_wine/save?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-mysql-tutorial-part-1%2Fh=PHP%2FMySQL+Tutorial+Part+1" rel="nofollow" title="Add to&nbsp;Newsvine"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/newsvine.png" title="Add to&nbsp;Newsvine" alt="Add to&nbsp;Newsvine" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-mysql-tutorial-part-1%2Ftitle=PHP%2FMySQL+Tutorial+Part+1" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.squidoo.com/lensmaster/bookmark?http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-mysql-tutorial-part-1%2F" rel="nofollow" title="Add to&nbsp;Squidoo"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/squidoo.png" title="Add to&nbsp;Squidoo" alt="Add to&nbsp;Squidoo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bestwebezy.com%2Fphp-mysql%2Fphp-mysql-tutorial-part-1%2Ft=PHP%2FMySQL+Tutorial+Part+1" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.bestwebezy.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.bestwebezy.com/php-mysql/php-mysql-tutorial-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

