<?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>PHP Architect blog &#187; MySQL</title>
	<atom:link href="http://www.php-architect.com/blog/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.php-architect.com/blog</link>
	<description>PHP, MySQL, ZF, Python, Linux, Mac, C++, Java, Flex, Air, ActionScript &#38; apps development.</description>
	<lastBuildDate>Sun, 13 Jun 2010 18:25:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=8291</generator>
		<item>
		<title>Build MySQL insert Query from Array that contains fields and values</title>
		<link>http://www.php-architect.com/blog/2009/02/22/build-mysql-insert-query-from-array-that-contains-fields-and-values/</link>
		<comments>http://www.php-architect.com/blog/2009/02/22/build-mysql-insert-query-from-array-that-contains-fields-and-values/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 12:30:50 +0000</pubDate>
		<dc:creator>Me2resh</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[query]]></category>

		<guid isPermaLink="false">http://www.php-architect.com/blog/?p=261</guid>
		<description><![CDATA[The following function takes table name, and array where its keys are the table fields and it&#8217;s values are the values to insert in each field, it constructs the MySQL Query based on the input and executes it to insert the data. function insertRow&#40;$table_name, $input_array&#41;&#123; $link = mysql_connect&#40;SERVER, USER, PASS&#41;; mysql_select_db&#40;DATABASE, $link&#41;; $SQL = &#34;INSERT [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>The following function takes table name, and array where its keys are the table fields and it&#8217;s values are the values to insert in each field, it constructs the MySQL Query based on the input and executes it to insert the data.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> insertRow<span style="color: #009900;">&#40;</span><span style="color: #000088;">$table_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$input_array</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span>SERVER<span style="color: #339933;">,</span> USER<span style="color: #339933;">,</span> PASS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span>DATABASE<span style="color: #339933;">,</span> <span style="color: #000088;">$link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$SQL</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;INSERT INTO <span style="color: #006699; font-weight: bold;">$table_name</span> &quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$fields</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;(&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$values</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;(&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$input_array</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$fields</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;`<span style="color: #006699; font-weight: bold;">$k</span>` ,&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$values</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;'<span style="color: #006699; font-weight: bold;">$v</span>' ,&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$fields</span> <span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;#&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$values</span> <span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;#&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$fields</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,#&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fields</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$fields</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$values</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,#&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$values</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$values</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$values</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$fields</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;)&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$values</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;)&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$SQL</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$fields</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; VALUES &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$values</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$SQL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">mysql_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.php-architect.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.php-architect.com/blog/2009/02/22/build-mysql-insert-query-from-array-that-contains-fields-and-values/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fix the MySQL PHP issue in Leopard (mysql.sock file)</title>
		<link>http://www.php-architect.com/blog/2008/01/07/fix-the-mysql-php-issue-in-leopard-mysqlsock-file/</link>
		<comments>http://www.php-architect.com/blog/2008/01/07/fix-the-mysql-php-issue-in-leopard-mysqlsock-file/#comments</comments>
		<pubDate>Mon, 07 Jan 2008 13:39:25 +0000</pubDate>
		<dc:creator>Me2resh</dc:creator>
				<category><![CDATA[Mac OS]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[arabic]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://www.abdelaliem.com/blog/?p=20</guid>
		<description><![CDATA[This is a known issue in Leopard, basically the system is looking for the mysql.sock file in the wrong place. Just need to create a symlink and you should be in business: sudo mkdir /var/mysql/ sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p><span class="postbody">This is a known issue in Leopard, basically the system is looking for the mysql.sock file in the wrong place. Just need to create a symlink and you should be in business:</p>
<p>sudo mkdir /var/mysql/<br />
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock </span></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.php-architect.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.php-architect.com/blog/2008/01/07/fix-the-mysql-php-issue-in-leopard-mysqlsock-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
