<?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>Ajay Kumar Singh &#187; PHP</title>
	<atom:link href="http://www.ajaykumarsingh.com/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ajaykumarsingh.com</link>
	<description>Blogging [^Singh^]</description>
	<lastBuildDate>Sat, 28 Aug 2010 15:05:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Notice: A session had already been started – ignoring session_start() in .. on line ..</title>
		<link>http://www.ajaykumarsingh.com/php/notice-a-session-had-already-been-started-ignoring-session_start-in-on-line.html</link>
		<comments>http://www.ajaykumarsingh.com/php/notice-a-session-had-already-been-started-ignoring-session_start-in-on-line.html#comments</comments>
		<pubDate>Tue, 15 Jan 2008 23:49:42 +0000</pubDate>
		<dc:creator>Ajay Kumar Singh</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ajaykumarsingh.com/?p=8</guid>
		<description><![CDATA[For an error like this Notice: A session had already been started &#8211; ignoring session_start() in .. on line .. This happens when you try to start session more than once. The solution for above problem is 1) in php.ini file set session.autostart to 0 session.auto_start = 0 2) In your code use this line [...]]]></description>
			<content:encoded><![CDATA[<p>For an error like this</p>
<p><strong>Notice: A session had already been started &#8211; ignoring session_start() in .. on line ..</strong></p>
<p>This happens when you try to start session more than once.</p>
<p>The solution for above problem is</p>
<p>1) in php.ini file set session.autostart to 0</p>
<p><strong>session.auto_start = 0</strong></p>
<p>2) In your code use this line</p>
<p><strong>if (!session_id()) session_start();</strong></p>
<p>instead of</p>
<p><strong>session_start(); </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ajaykumarsingh.com/php/notice-a-session-had-already-been-started-ignoring-session_start-in-on-line.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to import .sql file in mySQL database?</title>
		<link>http://www.ajaykumarsingh.com/mysql/how-to-import-sql-file-in-mysql-database.html</link>
		<comments>http://www.ajaykumarsingh.com/mysql/how-to-import-sql-file-in-mysql-database.html#comments</comments>
		<pubDate>Tue, 15 Jan 2008 23:40:12 +0000</pubDate>
		<dc:creator>Ajay Kumar Singh</dc:creator>
				<category><![CDATA[mySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ajaykumarsingh.com/?p=7</guid>
		<description><![CDATA[There are 3 ways to import  .sql database file in mySQL. 1) Import the .sql file from phpMyAdmin Import -&#62; Browse for the .sql file and click on GO. If you are lucky your databae will be imported if not look for next 2 methods 2) Run the sql query from command prompt if you [...]]]></description>
			<content:encoded><![CDATA[<p>There are 3 ways to import  .sql database file in mySQL.</p>
<p><strong>1) Import the .sql file from phpMyAdmin</strong></p>
<p>Import -&gt; Browse for the .sql file and click on GO.</p>
<p>If you are lucky your databae will be imported if not look for next 2 methods</p>
<p>2) Run the sql query from command prompt if you have access to your webhost either direct or via SSH</p>
<p>The sql query to import .sql database is</p>
<p class="MsoNormal"><font color="#808000"><span lang="EN-GB">mysql -h </span><strong><span style="font-family: Verdana" lang="EN-GB">host</span></strong><span lang="EN-GB"> -u <strong>databaseusername</strong></span><span style="font-family: Verdana" lang="EN-GB"> </span><span lang="EN-GB">-p <strong>databasename</strong></span><span style="font-family: Verdana" lang="EN-GB"> </span><span lang="EN-GB">&lt; <strong>database.sql</strong></span></font></p>
<p class="MsoNormal">Replace</p>
<p class="MsoNormal"><strong>host</strong> with your actual host (in most cases it would be localhost)</p>
<p><strong>databaseusername</strong> with the user name assigned to access above database</p>
<p class="MsoNormal"><strong>databasename</strong> with your actual database name</p>
<p class="MsoNormal">database.sql with your actual .sql file</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ajaykumarsingh.com/mysql/how-to-import-sql-file-in-mysql-database.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Tutorial</title>
		<link>http://www.ajaykumarsingh.com/php/php-tutorial-introduction.html</link>
		<comments>http://www.ajaykumarsingh.com/php/php-tutorial-introduction.html#comments</comments>
		<pubDate>Tue, 15 Jan 2008 22:43:41 +0000</pubDate>
		<dc:creator>Ajay Kumar Singh</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ajaykumarsingh.com/?p=3</guid>
		<description><![CDATA[PHP stands for PHP Hypertext Preprocessor. PHP was developed to be a preprocessor language but it lost it track for good and now it has become the de facto language for dynamic websites. PHP has given tough time to its rival ASP and now it is on top. PHP is Object Oriented like C++. Its [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> stands for <strong>P</strong>HP <strong>H</strong>ypertext <strong>P</strong>reprocessor.</p>
<p><a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> was developed to be a preprocessor language but it lost it track for good and now it has become the de facto language for dynamic websites.</p>
<p><a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> has given tough time to its rival ASP and now it is on top.</p>
<p><a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> is Object Oriented like C++. Its syntax are something similar to C/Perl/C++ and if you are coming from C/C++/Perl background then you will find it easier to learn.</p>
<p><a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> is server side scripting language and requires a database to show its magic. However it doesn&#8217;t stop you using it without database.</p>
<p>I prefer <a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> over HTML and you may observe that most of my websites are in <a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> (without database)</p>
<p>E.g. <a href="http://www.SwamiWebDesign.co.uk" title="SwamiWebDesign" target="_blank">SwamiWebDesign</a>, <a href="http://www.SwamiTextLinks.com" title="SwamiTextLinks" target="_blank">SwamiTextLinks</a>, <a href="http://www.saipl.in" title="SAIPL" target="_blank">SAIPL</a></p>
<p>You must learn at least mySQL (Preferred database for <a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a>) to learn the full potential of <a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a>/mySQL combination.</p>
<p>And most importantly <a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> is <strong>free</strong>.</p>
<p><a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> is portable meaning you can write the script and execute it on any web server including Apache, IIS etc.</p>
<p><strong>PHP Syntax</strong></p>
<p><a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> is the strangest language I&#8217;ve ever known.  None of other languages use same syntax as <a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a>.</p>
<p>A typical <a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> code starts with <strong>&lt;?php</strong> and ends with <strong>?&gt;</strong></p>
<p>And you need to be careful with the spaces. Any space between <strong>&lt;</strong> and <strong>?</strong> means you see nothing in web browser.</p>
<p>Here is our first <a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> script</p>
<p><em>&lt;?php  echo &#8220;Namaskar&#8221;; ?&gt;</em></p>
<p>Humm!!! where is the typical &#8220;Hello World!!&#8221; ? Well its my style so live with it. <em><strong>Namaskar </strong></em>is greeting in Hindi and it is used for evrything from Hi/Hello/Good morning/Afternoon/Night to Bye.</p>
<p>And yes did you recognize ; didn&#8217;t I say <a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> is similar to C/C++.</p>
<p>And the following would be our full code embedded inside html</p>
<p><font color="#808000">&lt;html&gt;</font></p>
<p><font color="#808000">&lt;body&gt;</font></p>
<p><font color="#808000"> &lt;?php  </font></p>
<p><font color="#808000">echo &#8220;Namaskar&#8221;; </font></p>
<p><font color="#808000">?&gt;</font></p>
<p><font color="#808000">&lt;/body&gt;</font></p>
<p><font color="#808000">&lt;/html&gt; </font></p>
<p><font color="#000000">Copy &amp; paste above code and save in a file with .php (e.g.  file.php ) extension and put it on your server.</font></p>
<p>Access this file from your browser (http://www.yourdomain.com/file.php or http://localhost/file.php if you are running on WAMP on your own local server) and you will see your first successful php script.</p>
<p>Say Cheers!!!</p>
<p><a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a><strong> Comments</strong></p>
<p><a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> comments are borrowed from C/C++ and support both single line C++ style comments and  C style block comments</p>
<p><font color="#808000">// This is a comment in </font><a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a></p>
<p><font color="#808000">/****</font></p>
<p><font color="#808000">This is a comment</font></p>
<p><font color="#808000">in </font><a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a></p>
<p><font color="#808000">******/</font></p>
<p><strong>PHP Variables</strong></p>
<p>As with every other programming languages <a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> rely on variables. Variables are those entities which hold data.</p>
<p>In <a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> a variable name starts with $ sign.</p>
<p>E.g.</p>
<p>$thisIsAString = &#8220;Namaskar&#8221;;</p>
<p>$myLuckyNumber = 12345;</p>
<p>Humm!!! excuse me what about  the variable type? How does PHP know which variable is going to store what?</p>
<p>Well <a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> is loosely typed script meaning that it doesn&#8217;t need to know the type of variable in advance. This is really cool isn&#8217;t it? you don&#8217;t need to worry about C++ type_cast styles any more.</p>
<p><strong>Simple rules for variable names</strong></p>
<p>1) A variable name must start with a letter or underscore _</p>
<p>2) A variable name must contain only alphanumeric characters and underscores.</p>
<p>E.g. a-z, 0-9, and _</p>
<p>Wow! very simple rule can, be remembered easily.</p>
<p><strong>Strings </strong></p>
<p>You can&#8217;t think of any language without strings can you?</p>
<p>Think of perl and you know what I mean.</p>
<p>As explained in my previous tutorial a string can be declared as variable. A string can also be used directly instead of assigning it to a variable and using it.</p>
<p>Lets take an example.</p>
<p><font color="#808000">$string1 = &#8220;Namaskar&#8221;;</font></p>
<p><font color="#808000">$string2=&#8221;World&#8221;;</font></p>
<p><font color="#808000">$string3 = $string1 . &#8221; &#8221; . $string2 . &#8220;!&#8221;;</font></p>
<p><font color="#808000">echo $string3; </font></p>
<p>The echo will print</p>
<p><font color="#808000">Namaskar World! </font></p>
<p>We have seen some of string operations in the above code also.</p>
<p><strong>Concatenate Oprator</strong></p>
<p>. is a concatenate operator used to concatenate two or more strings.</p>
<p>You can find rest of string related functions on <a href="http://www.swamiwebdesign.co.uk/php_development.php" title="PHP" target="_blank">PHP</a> language home page <a href="http://www.php.net" title="PHP" target="_blank">http://www.php.net</a></p>
<p><strong>Include and require functions</strong></p>
<p>Include and require functions are used to include files.</p>
<p>E.g.</p>
<p>&lt;?php include(&#8220;leftMenu.php&#8221;); ?&gt;</p>
<p>&lt;?php require(&#8220;leftMenu.php&#8221;); ?&gt;</p>
<p><strong>Difference between <em>include</em> and  <em>require</em></strong></p>
<p>With include the rest of code will execute even included files were not found whereas require will not execute any code if it finds any error.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ajaykumarsingh.com/php/php-tutorial-introduction.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
