<?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>Xyiry PHP Blog &#124; Where Open Source Lives &#187; PHP</title>
	<atom:link href="http://php.xyiry.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://php.xyiry.com</link>
	<description>My open source playground</description>
	<lastBuildDate>Tue, 30 Nov 2010 06:08:07 +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 Implode array elements</title>
		<link>http://php.xyiry.com/php-implode-array-elements/</link>
		<comments>http://php.xyiry.com/php-implode-array-elements/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 12:02:48 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/?p=47</guid>
		<description><![CDATA[If you are having 1 dimension array and you would like to use this type of array in you mysql query you can use the PHP implode function. -------------------------------- Example Array -------------------------------- echo "&#60;pre&#62;"; print_r($yearSearch); Array ( [0] =1979 [1] =1980 [2] =1981 [3] =1982 [4] =1983 [5] =1984 [6] =1985 [7] =1986 [8] =1987 [...]]]></description>
			<content:encoded><![CDATA[<pre>If you are having 1 dimension array and you would like to use this type of array in you mysql query
you can use the PHP implode function.
--------------------------------
Example Array
--------------------------------
echo "&lt;pre&gt;";
print_r($yearSearch);

Array
(
    [0] =1979
    [1] =1980
    [2] =1981
    [3] =1982
    [4] =1983
    [5] =1984
    [6] =1985
    [7] =1986
    [8] =1987
    [9] =1988
    [10] =1989
    [11] =1990
    [12] =1991
    [13] =1992
    [14] =1993
)
--------------------------------
Example Implode
--------------------------------
echo  $array = implode(",", $yearSearch);</pre>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/php-implode-array-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP find value in array</title>
		<link>http://php.xyiry.com/php-find-value-in-array/</link>
		<comments>http://php.xyiry.com/php-find-value-in-array/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 04:02:22 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/php-find-value-in-array/</guid>
		<description><![CDATA[# Note : This function is for you to find any value needed in an array. Example : If you want to find &#8220;mysql&#8221; in an array you may use the function &#8220;in_array&#8221; below. &#60;? $xyiry = array(&#8220;mysql&#8221;, &#8220;oracle&#8221;, &#8220;informix&#8221;, &#8220;db2&#8243;); if (in_array(&#8220;mysql&#8221;, $xyiry)) { echo &#8220;This Database Is Using mySQL&#8221;; } ?&#62;]]></description>
			<content:encoded><![CDATA[<p># Note : This function is for you to find any value needed in an array.</p>
<p>Example : If you want to find &#8220;mysql&#8221; in an array you may use the function &#8220;in_array&#8221; below.</p>
<p>&lt;?<br />
$xyiry = array(&#8220;mysql&#8221;, &#8220;oracle&#8221;, &#8220;informix&#8221;, &#8220;db2&#8243;);<br />
if (in_array(&#8220;mysql&#8221;, $xyiry)) {<br />
echo &#8220;This Database Is Using mySQL&#8221;;<br />
}<br />
?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/php-find-value-in-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Help &#8211; PHP upload script</title>
		<link>http://php.xyiry.com/php-help-php-upload-script/</link>
		<comments>http://php.xyiry.com/php-help-php-upload-script/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 16:36:18 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/?p=19</guid>
		<description><![CDATA[//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV // PHP Help &#8211; PHP upload script //VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ****************************************************************** Title : PHP upload Script Usage : to upload files to server Programmer : Mohd Izzairi Yamin ****************************************************************** Hi Guys, this is php upload script function. &#60;?php $MAX_SIZE = 2000000; $FILE_EXTS = array(&#8216;.doc&#8217;); $DELETABLE = true; $site_name = $_SERVER['HTTP_HOST']; $url_dir = &#8220;http://&#8221;.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']); $url_this = &#8220;http://&#8221;.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; [...]]]></description>
			<content:encoded><![CDATA[<p>//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV<br />
// PHP Help &#8211; PHP upload script<br />
//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV<br />
******************************************************************<br />
Title : PHP upload Script<br />
Usage : to upload files to server<br />
Programmer : Mohd Izzairi Yamin<br />
******************************************************************</p>
<p>Hi Guys, this is php upload script function.</p>
<p>&lt;?php</p>
<p>$MAX_SIZE = 2000000;<br />
$FILE_EXTS = array(&#8216;.doc&#8217;);<br />
$DELETABLE = true;<br />
$site_name = $_SERVER['HTTP_HOST'];<br />
$url_dir = &#8220;http://&#8221;.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);<br />
$url_this = &#8220;http://&#8221;.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];</p>
<p>$upload_dir = &#8220;upload_folder/&#8221;;<br />
$upload_url = $url_dir.&#8221;/upload_folder/&#8221;;<br />
$message =&#8221;";</p>
<p>if (!is_dir(&#8220;upload_folder&#8221;)) {<br />
if (!mkdir($upload_dir))<br />
die (&#8220;upload_files directory doesn&#8217;t exist and creation failed&#8221;);<br />
if (!chmod($upload_dir,0755))<br />
die (&#8220;change permission to 755 failed.&#8221;);<br />
}</p>
<p>if (isset($_REQUEST['del']))<br />
$pos = strpos( $_REQUEST['del'],&#8221;/&#8221;);<br />
//echo &#8220;pos = $pos&lt;hr&gt;&#8221;;<br />
//echo &#8220;del = &#8220;.$_REQUEST[del];</p>
<p>//echo substr($_REQUEST['del'],0,$pos).&#8221;=&#8221;.$upload_dir;</p>
<p>if ($_REQUEST['del'] &amp;&amp; $DELETABLE) {</p>
<p>$resource = fopen(&#8220;log.txt&#8221;,&#8221;a&#8221;);<br />
fwrite($resource,date(&#8220;Ymd h:i:s&#8221;).&#8221;DELETE &#8211; $_SERVER[REMOTE_ADDR]&#8220;.&#8221;$_REQUEST[del]\n&#8221;);<br />
fclose($resource);</p>
<p>if (strpos($_REQUEST['del'],&#8221;/.&#8221;)&gt;0); //possible hacking<br />
else if (strpos($_REQUEST['del'],$upload_dir) === false); //possible hacking<br />
//else if (substr($_REQUEST['del'],0,6)==$upload_dir) {<br />
else if (substr($_REQUEST['del'],0,$pos+1)==$upload_dir) { // compare the upload folder name (&#8216;upload_faststart/&#8217;)<br />
echo &#8220;del = &#8220;.$_REQUEST[del];<br />
unlink($_REQUEST[del]);<br />
print &#8220;&lt;script&gt;window.location.href=&#8217;$url_this?message=deleted successfully&#8217;&lt;/script&gt;&#8221;;<br />
}<br />
}<br />
else if ($_FILES['userfile']) {<br />
$resource = fopen(&#8220;log.txt&#8221;,&#8221;a&#8221;);<br />
fwrite($resource,date(&#8220;Ymd h:i:s&#8221;).&#8221;UPLOAD &#8211; $_SERVER[REMOTE_ADDR]&#8221;<br />
.$_FILES['userfile']['name'].&#8221; &#8221;<br />
.$_FILES['userfile']['type'].&#8221;\n&#8221;);<br />
fclose($resource);<br />
<span id="more-19"></span><br />
$file_type = $_FILES['userfile']['type'];<br />
$file_name = $_FILES['userfile']['name'];<br />
$file_ext = strtolower(substr($file_name,strrpos($file_name,&#8221;.&#8221;)));</p>
<p>//File Size Check<br />
if ( $_FILES['userfile']['size'] &gt; $MAX_SIZE)<br />
$message = &#8220;The file size is over 2MB.&#8221;;<br />
//File Extension Check<br />
else if (!in_array($file_ext, $FILE_EXTS))<br />
$message = &#8220;Sorry, $file_name($file_type) is not allowed to be uploaded.&#8221;;<br />
else<br />
$message = do_upload($upload_dir, $upload_url);</p>
<p>print &#8220;&lt;script&gt;window.location.href=&#8217;$url_this?message=$message&#8217;&lt;/script&gt;&#8221;;<br />
}<br />
else if (!$_FILES['userfile']);<br />
else<br />
$message = &#8220;Invalid File Specified.&#8221;;<br />
$handle=opendir($upload_dir);<br />
$filelist = &#8220;&#8221;;<br />
while ($file = readdir($handle)) {<br />
if(!is_dir($file) &amp;&amp; !is_link($file)) {<br />
$filelist .= &#8220;&lt;a href=&#8217;$upload_dir$file&#8217;&gt;&#8221;.$file.&#8221;&lt;/a&gt;&#8221;;<br />
$name=&#8221;Update&#8221;;<br />
if ($DELETABLE)<br />
$filelist .= &#8220;&lt;TD colspan=&#8217;2&#8242; align=&#8217;left&#8217; class=&#8217;content1&#8242;&gt;&#8221;;<br />
$filelist .= &#8221;   &#8220;;<br />
$filelist .= &#8220;&lt;img src=&#8217;images/actions_track.gif&#8217; width=&#8217;32&#8242; height=&#8217;32&#8242;&gt;&#8221;;<br />
$filelist .= &#8221;    &lt;a href=&#8217;converter_cpd.php?filename=&#8221;.urlencode($file).&#8221;&amp;date=&#8221;.date(&#8220;d-M-y&#8221;, filemtime($upload_dir.$file)).&#8221;&amp;iyear=&#8221;.$iyear.&#8221;&#8216;&gt;[ $name ]&lt;/a&gt;  &#8220;;<br />
$filelist .= &#8221;    &lt;a href=&#8217;?del=$upload_dir&#8221;.urlencode($file).&#8221;&#8216; title=&#8217;delete&#8217;&gt;Delete&lt;/a&gt;  &#8220;;</p>
<p>$filelist .= &#8220;&lt;font color=#000099 size=2&gt; &#8220;.date(&#8220;d-m-Y&#8221;, filemtime($upload_dir.$file))<br />
.&#8221;&lt;/font&gt;&#8221;;<br />
$filelist .=&#8221;&lt;/td&gt;&#8221;;<br />
$filelist .=&#8221;&lt;br&gt;&#8221;;<br />
}<br />
}</p>
<p>function do_upload($upload_dir, $upload_url) {</p>
<p>$temp_name = $_FILES['userfile']['tmp_name'];<br />
$file_name = $_FILES['userfile']['name'];<br />
$file_name = str_replace(&#8220;\\&#8221;,&#8221;",$file_name);<br />
$file_name = str_replace(&#8220;&#8216;&#8221;,&#8221;",$file_name);<br />
$file_path = $upload_dir.$file_name;</p>
<p>if ( $file_name ==&#8221;") {<br />
$message = &#8220;Invalid File Name Specified&#8221;;<br />
return $message;<br />
}</p>
<p>$result = move_uploaded_file($temp_name, $file_path);<br />
if (!chmod($file_path,0777))<br />
$message = &#8220;change permission to 777 failed.&#8221;;<br />
else<br />
$message = ($result)?&#8221;$file_name uploaded successfully.&#8221; :<br />
&#8220;Somthing is wrong with uploading a file.&#8221;;<br />
return $message;<br />
}</p>
<p>?&gt;</p>
<p>&lt;center&gt;<br />
&lt;p&gt;&lt;/p&gt; &lt;p&gt;</p>
<p>&lt;/font&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;br&gt;Xyiry Upload Function&lt;/p&gt;</p>
<p>&lt;/p&gt;&lt;font type=&#8221;verdana&#8221; color=Blue size=&#8221;3&#8243;&gt;</p>
<p>&lt;?=$_REQUEST['message']?&gt;&lt;/font&gt;</p>
<p>&lt;form name=&#8221;upload&#8221; id=&#8221;upload&#8221; enctype=&#8221;multipart/form-data&#8221; method=&#8221;post&#8221;&gt;<br />
&lt;strong&gt;Upload File&lt;/strong&gt;<br />
&lt;input type=&#8221;file&#8221; id=&#8221;userfile&#8221; name=&#8221;userfile&#8221;&gt;<br />
&lt;input type=&#8221;submit&#8221; name=&#8221;upload&#8221; value=&#8221;Upload&#8221;&gt;<br />
&lt;/font&gt;<br />
&lt;/form&gt;<br />
&lt;br&gt;<br />
xyiry Files<br />
&lt;hr width=70% noshade&gt;<br />
&lt;? echo $filelist?&gt;<br />
&lt;? echo $file_name ?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/php-help-php-upload-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Help &#8211; To break record into new line</title>
		<link>http://php.xyiry.com/php-help-to-break-record-into-new-line/</link>
		<comments>http://php.xyiry.com/php-help-to-break-record-into-new-line/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 16:35:38 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/?p=18</guid>
		<description><![CDATA[//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV // PHP Help &#8211; To break record into new line //VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV **************************************************************** Title : Break into new lines Purpose : To break each record queried into new lines Programmer : Mohd Izzairi Yamin ****************************************************************** &#60;? while ($results = mysql_fetch_array($answers)) { // this sticks the results row by row into an array called $row. // [...]]]></description>
			<content:encoded><![CDATA[<p>//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV<br />
// PHP Help &#8211; To break record into new line<br />
//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV</p>
<p>****************************************************************<br />
Title : Break into new lines<br />
Purpose : To break each record queried into new lines<br />
Programmer : Mohd Izzairi Yamin<br />
******************************************************************</p>
<p>&lt;?</p>
<p>while ($results = mysql_fetch_array($answers)) {<br />
// this sticks the results row by row into an array called $row.<br />
// rows are called as $array_name["COLUMN_NAME"]<br />
//$out =<br />
$out .= $results["ID"].&#8217;,';<br />
$out .= $results["IC_NUMBER"].&#8217;,';<br />
$out .= $results["-"].&#8217;,';<br />
$out .= $results["POSITION"].&#8217;\n&#8217;;<br />
$out .= $results["EDUCATION_LEVEL"].&#8217;\n&#8217;;</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/php-help-to-break-record-into-new-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Help &#8211; Write PHP into functions</title>
		<link>http://php.xyiry.com/php-help-write-php-into-functions/</link>
		<comments>http://php.xyiry.com/php-help-write-php-into-functions/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 16:35:18 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/?p=17</guid>
		<description><![CDATA[//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV // PHP Help &#8211; Write PHP into functions //VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ***************************************************************** Title : Writing PHP functions Usage : to use only one type of sql_query with different databases Purpose : mini database abstraction eg: sqlite and mysql Programmer : Mohd Izzairi Yamin Filename : library.php ****************************************************************** &#60;?php $database=&#8221;mysql&#8221;; // determine the database you want to [...]]]></description>
			<content:encoded><![CDATA[<p>//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV<br />
// PHP Help &#8211; Write PHP into functions<br />
//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV</p>
<p>*****************************************************************<br />
Title : Writing PHP functions<br />
Usage : to use only one type of sql_query with different databases<br />
Purpose : mini database abstraction eg: sqlite and mysql<br />
Programmer : Mohd Izzairi Yamin<br />
Filename : library.php<br />
******************************************************************</p>
<p>&lt;?php</p>
<p>$database=&#8221;mysql&#8221;; // determine the database you want to use eg: mysql, sqlite</p>
<p>if ($database==&#8221;mysql&#8221;){<br />
$db = mysql_pconnect(&#8220;localhost&#8221;,&#8221;root&#8221;,&#8221;root&#8221;);<br />
mysql_select_db(&#8220;mobile&#8221;);<br />
}<br />
if ($database==&#8221;sqlite&#8221;){<br />
$db = sqlite_open(&#8216;authentication.db&#8217;);<br />
}</p>
<p>if ($database==&#8221;mysql&#8221;){<br />
function db_query($sql){ // to remember the variable positioning<br />
$res = mysql_query($sql);<br />
return $res;<br />
}<br />
function db_fetch_array($res) {<br />
$arr = mysql_fetch_assoc($res);<br />
return $arr;<br />
}<br />
}</p>
<p><span id="more-17"></span><br />
if ($database==&#8221;sqlite&#8221;){<br />
global $db; // to get the value from outside the function<br />
function db_query($sql) { // to remember the variable positioning<br />
$res = sqlite_query($db,$sql);<br />
return $res;<br />
}</p>
<p>function db_fetch_array($res) {<br />
$arr = sqlite_fetch_array($res);<br />
return $arr;<br />
}<br />
}</p>
<p>//example of your SQL that you will be using in your codes are:</p>
<p>$res=db_query(&#8220;select * from table where field=&#8217;001&#8242;&#8221;);<br />
$arr=db_fetch_array($res);</p>
<p>?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/php-help-write-php-into-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Help &#8211; PHP md5 encryptions</title>
		<link>http://php.xyiry.com/php-help-php-md5-encryptions/</link>
		<comments>http://php.xyiry.com/php-help-php-md5-encryptions/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 16:34:56 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/?p=16</guid>
		<description><![CDATA[//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV // PHP Help &#8211; PHP md5 encryptions //VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV **************************************************************** Title : Md5 password Usage : to use a one way encryption after login and saves into database Programmer : Mohd Izzairi Yamin ***************************************************************** &#60;? include_once&#8221;connections.php&#8221;; $username=$_REQUEST['username']; $password=$_REQUEST['password']; $encrpt_pwd=md5($password); // eg: 63a9f0ea7bb98050796b649e85481845 it will save in this encrypted format. //eg: posting to an oracle Database. [...]]]></description>
			<content:encoded><![CDATA[<p>//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV<br />
// PHP Help &#8211; PHP md5 encryptions<br />
//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV</p>
<p>****************************************************************<br />
Title : Md5 password<br />
Usage : to use a one way encryption after login and saves into database<br />
Programmer : Mohd Izzairi Yamin<br />
*****************************************************************</p>
<p>&lt;?</p>
<p>include_once&#8221;connections.php&#8221;;</p>
<p>$username=$_REQUEST['username'];<br />
$password=$_REQUEST['password'];</p>
<p>$encrpt_pwd=md5($password);<br />
// eg: 63a9f0ea7bb98050796b649e85481845 it will save in this encrypted format.</p>
<p>//eg: posting to an oracle Database. Its up to you what DB you are using.<br />
$sql=&#8221;INSERT INTO AUTHENTICATION (USERNAME,PASSWORD)VALUES (&#8216;$USERNAME&#8217;,'$PASSWORD&#8217;)&#8221;;<br />
$sql_rs=oraquery($sql);</p>
<p>//Note: If you want to do a password checking after login, you just need to reverse this process<br />
//Note: Do a SQL select statement from the database and get the result and just match the result with the<br />
// passed parameters that has been converted into md5, that will do the matching authentication.</p>
<p>?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/php-help-php-md5-encryptions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Help &#8211; Drop Down Menu With Redirect (form.submit)</title>
		<link>http://php.xyiry.com/php-help-drop-down-menu-with-redirect-formsubmit/</link>
		<comments>http://php.xyiry.com/php-help-drop-down-menu-with-redirect-formsubmit/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 16:34:38 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/?p=15</guid>
		<description><![CDATA[//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV // PHP Help &#8211; Drop Down Menu With Redirect (form.submit) //VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV **************************************************************** Title : Drop Down Menu With Redirect Purpose : To post to result page automatically without submit Programmer : Mohd Izzairi Yamin ****************************************************************** &#60;form name=&#8221;mtnCourseAdd.php&#8221; method=&#8221;post&#8221; action=&#8221;agent_results.php&#8221;&#62; &#60;select name=&#8221;AGENT&#8221; onChange=form.submit()&#62; &#60;option value=&#8221;"&#62;- All Courses -&#60;/option&#62; &#60;? $sql2 = &#8220;SELECT * FROM USERID [...]]]></description>
			<content:encoded><![CDATA[<p>//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV<br />
// PHP Help &#8211; Drop Down Menu With Redirect (form.submit)<br />
//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV</p>
<p>****************************************************************<br />
Title : Drop Down Menu With Redirect<br />
Purpose : To post to result page automatically without submit<br />
Programmer : Mohd Izzairi Yamin<br />
******************************************************************</p>
<p>&lt;form name=&#8221;mtnCourseAdd.php&#8221; method=&#8221;post&#8221; action=&#8221;agent_results.php&#8221;&gt;</p>
<p>&lt;select name=&#8221;AGENT&#8221; onChange=form.submit()&gt;<br />
&lt;option value=&#8221;"&gt;- All Courses -&lt;/option&gt;<br />
&lt;? $sql2 = &#8220;SELECT * FROM USERID order by SCOURSENAME&#8221;;<br />
$rs2 = oraquery($sql2);?&gt;<br />
&lt;?<br />
for($r=0; $r&lt;count($rs2); $r++) {<br />
$code = $rs2[$r][3];<br />
$name=$rs2[$r][2];</p>
<p>$selectedindex=$_REQUEST['FCPDHOURS'];<br />
$selectedOrNot = (($name==$selectedindex)?&#8221; selected&#8221;:&#8221;");<br />
echo &#8220;&lt;option value=&#8217;$name&#8217; $selectedOrNot &gt;$name&lt;/option&gt;\n&#8221;;<br />
}<br />
?&gt;<br />
&lt;/select&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/php-help-drop-down-menu-with-redirect-formsubmit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Help &#8211; Write CSV files with PHP</title>
		<link>http://php.xyiry.com/php-help-write-csv-files-with-php/</link>
		<comments>http://php.xyiry.com/php-help-write-csv-files-with-php/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 16:34:15 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/?p=14</guid>
		<description><![CDATA[//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV // PHP Help &#8211; Write CSV files with PHP //VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV Programmer : Mohd Izzairi Yamin This sample file will read from a CSV file and create an SQL insert string to insert to a fictional database (no actual SQL INSERT is performed here &#8211; just an example of concept) &#60;?php $row = 1; $handle [...]]]></description>
			<content:encoded><![CDATA[<p>//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV<br />
// PHP Help &#8211; Write CSV files with PHP<br />
//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV<br />
Programmer : Mohd Izzairi Yamin</p>
<p>This sample file will read from a CSV file and create an SQL insert string to insert to a fictional database (no actual SQL INSERT is performed here &#8211; just an example of concept)</p>
<p>&lt;?php<br />
$row = 1;<br />
$handle = fopen(&#8220;samplecsv.csv&#8221;, &#8220;r&#8221;);<br />
while (($data = fgetcsv($handle, 1000, &#8220;|&#8221;)) !== FALSE) { // 2000x<br />
$num = count($data);<br />
echo &#8220;&lt;p&gt; $num fields in line $row: &lt;br /&gt;&lt;/p&gt;\n&#8221;;<br />
$row++;<br />
for ($c=0; $c &lt; $num; $c++) { // 4x<br />
echo $data[$c] . &#8220;&lt;br /&gt;\n&#8221;;</p>
<p>}</p>
<p>$data[0] = $data[0] * .75;<br />
$sql = &#8220;INSERT INTO DB<br />
(col1,col2,col3,col4)<br />
values<br />
(&#8216;&#8221;.$data[0].&#8221;&#8216;,&#8217;&#8221;.$data[1].&#8221;&#8216;,&#8217;&#8221;.$data[2].&#8221;&#8216;,&#8217;&#8221;.$data[3].&#8221;&#8216;)&#8221;;<br />
echo &#8220;&lt;li&gt;&#8221;.$sql;<br />
}<br />
fclose($handle);<br />
?&gt;</p>
<p>Sample CSV DATA<br />
&#8212;&#8212;&#8212;&#8212;&#8212;<br />
&#8220;5&#8243;|&#8221;ALERT&#8221;|&#8221;0121111111&#8243;|&#8221;Hello&#8221;|<br />
&#8220;5&#8243;|&#8221;ALERT&#8221;|&#8221;0121111111&#8243;|&#8221;Are&#8221;|<br />
&#8220;5&#8243;|&#8221;ALERT&#8221;|&#8221;0121111111&#8243;|&#8221;You&#8221;|<br />
&#8220;5&#8243;|&#8221;ALERT&#8221;|&#8221;0121111111&#8243;|&#8221;There&#8221;|<br />
&#8220;5&#8243;|&#8221;ALERT&#8221;|&#8221;0121111111&#8243;|&#8221;Doing&#8221;|</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/php-help-write-csv-files-with-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Help &#8211; Calculate Differences of Two Dates</title>
		<link>http://php.xyiry.com/php-help-calculate-differences-of-two-dates/</link>
		<comments>http://php.xyiry.com/php-help-calculate-differences-of-two-dates/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 16:33:58 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/?p=13</guid>
		<description><![CDATA[//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV // PHP Help &#8211; Calculate Differences of Two Dates //VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV &#60;? //Purpose : Php function to find differences between two dates //Programmer : Mohd Izzairi Yamin function datedifferences($dformat, $endDate, $startDate) { $date_parts1=explode($dformat, $startDate); $date_parts2=explode($dformat, $endDate); $start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]); $end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]); return $end_date &#8211; $start_date; } $dob=&#8221;05/15/1980&#8243;; echo &#8220;Izzairi&#8217;s Birthday is &#8221; . $dob [...]]]></description>
			<content:encoded><![CDATA[<p>//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV<br />
// PHP Help &#8211; Calculate Differences of Two Dates<br />
//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV</p>
<p>&lt;?<br />
//Purpose : Php function to find differences between two dates<br />
//Programmer : Mohd Izzairi Yamin</p>
<p>function datedifferences($dformat, $endDate, $startDate)<br />
{<br />
$date_parts1=explode($dformat, $startDate);<br />
$date_parts2=explode($dformat, $endDate);<br />
$start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);<br />
$end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);<br />
return $end_date &#8211; $start_date;<br />
}<br />
$dob=&#8221;05/15/1980&#8243;;</p>
<p>echo &#8220;Izzairi&#8217;s Birthday is &#8221; . $dob . &#8220;, then today your age is approximately &#8221; . round(datedifferences(&#8220;/&#8221;, date(&#8220;m/d/Y&#8221;, time()), $dob)/365, 0) . &#8221; years.&#8221;;<br />
?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/php-help-calculate-differences-of-two-dates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Help &#8211; Creating database connection in objects</title>
		<link>http://php.xyiry.com/php-help-creating-database-connection-in-objects/</link>
		<comments>http://php.xyiry.com/php-help-creating-database-connection-in-objects/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 16:33:37 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/?p=12</guid>
		<description><![CDATA[//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV // PHP Help &#8211; Creating database connection in objects //VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV Click Here To Download &#60;? /*============================== # Module : PHP database class # Programmer : Mohd Izzairi Yamin # Date : 07/06/2007 10:00 # Modified : 07/06/2007 11:15 ================================*/ class connection{ function db_conn(){ $db = mysql_connect(&#8220;localhost&#8221;,&#8221;root&#8221;,&#8221;root&#8221;); mysql_select_db(&#8220;testdb&#8221;); } function db_query($sql) { global $res_rs,$res; $res [...]]]></description>
			<content:encoded><![CDATA[<p>//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV<br />
// PHP Help &#8211; Creating database connection in objects<br />
//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV</p>
<p><a href="http://www.xyiry.com/demo/lib.zip" title="Download Database Simple Library"><strong>Click Here To Download</strong></a></p>
<p>&lt;?</p>
<p>/*==============================<br />
# Module : PHP database class<br />
# Programmer : Mohd Izzairi Yamin<br />
# Date : 07/06/2007 10:00<br />
# Modified : 07/06/2007 11:15<br />
================================*/<br />
class connection{</p>
<p>function db_conn(){</p>
<p>$db = mysql_connect(&#8220;localhost&#8221;,&#8221;root&#8221;,&#8221;root&#8221;);<br />
mysql_select_db(&#8220;testdb&#8221;);<br />
}</p>
<p>function db_query($sql) {<br />
global $res_rs,$res;</p>
<p>$res = &#8220;$sql&#8221;;<br />
$res_rs=mysql_query($res);</p>
<p>return $res_rs;</p>
<p>}</p>
<p>function show_sql(){<br />
global $res;</p>
<p>print $res;</p>
<p>}</p>
<p><span id="more-12"></span>function db_fetch_array($res_rs) {<br />
global $res_rs,$arr;</p>
<p>$arr = mysql_fetch_array($res_rs);</p>
<p>return $arr;</p>
<p>}</p>
<p>function show_arr(){<br />
global $arr;</p>
<p>echo &#8220;&lt;pre&gt;&#8221;;<br />
print_r($arr);</p>
<p>}</p>
<p>}<br />
?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/php-help-creating-database-connection-in-objects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

