<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
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/"
> <channel><title>Comments on: How to: Connect to my MySQL Database server using command line and php</title> <atom:link href="http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/feed/" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/</link> <description>Every answer asks a more beautiful question.</description> <lastBuildDate>Fri, 10 Feb 2012 19:55:56 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Matt Moore</title><link>http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-67684</link> <dc:creator>Matt Moore</dc:creator> <pubDate>Tue, 31 Jan 2012 16:45:23 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-67684</guid> <description>edit to previous post :
$link = mysql_connect(&quot;localhost&quot;, &quot;USERNAME&quot;, &quot;PASSWORD&quot;);
sorry</description> <content:encoded><![CDATA[<p>edit to previous post :</p><p>$link = mysql_connect(&#8220;localhost&#8221;, &#8220;USERNAME&#8221;, &#8220;PASSWORD&#8221;);</p><p>sorry</p> ]]></content:encoded> </item> <item><title>By: Matt Moore</title><link>http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-67683</link> <dc:creator>Matt Moore</dc:creator> <pubDate>Tue, 31 Jan 2012 16:42:57 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-67683</guid> <description>In response to feedback &#039;3&#039; of this thread (and for anyone reading this who gets the same result). The only way i could remove the duplicate results after fetching an array query was to take the PRINT out of the code and put it into an ECHO command by adding an extra variable.(i used $range for this example but you can use anything)
e.g-
&lt;?php
$link = mysql_connect(&quot;localhost&quot;, &quot;USERNAME&quot;, &quot;HOST&quot;);
mysql_select_db(&quot;DATABASE&quot;);
$query = &quot;SELECT * FROM TABLE&quot;;
$result = mysql_query($query);
$range = &quot;&quot;;
while ($line=mysql_fetch_array($result))
{
foreach ($line as $value)
{
//$range .= $value;
}
$range .= &quot;$value&quot;;
mysql_close($link);
}
?&gt;
Then later in the code to produce the results from the query i put the ECHO in a  element:
&lt;!-- end #example --&gt;
not really related to much to the topic and i know there might be other easier ways but i thought it might help people who are new to PHP like me :)</description> <content:encoded><![CDATA[<p>In response to feedback &#8217;3&#8242; of this thread (and for anyone reading this who gets the same result). The only way i could remove the duplicate results after fetching an array query was to take the PRINT out of the code and put it into an ECHO command by adding an extra variable.(i used $range for this example but you can use anything)</p><p>e.g-</p><p>&lt;?php<br
/> $link = mysql_connect(&quot;localhost&quot;, &quot;USERNAME&quot;, &quot;HOST&quot;);<br
/> mysql_select_db(&quot;DATABASE&quot;);<br
/> $query = &quot;SELECT * FROM TABLE&quot;;<br
/> $result = mysql_query($query);<br
/> $range = &quot;&quot;;<br
/> while ($line=mysql_fetch_array($result))<br
/> {<br
/> foreach ($line as $value)<br
/> {</p><p> //$range .= $value;<br
/> }</p><p> $range .= &quot;$value&#8221;;<br
/> mysql_close($link);</p><p> }</p><p>?&gt;</p><p>Then later in the code to produce the results from the query i put the ECHO in a  element:</p><p></p><p>not really related to much to the topic and i know there might be other easier ways but i thought it might help people who are new to PHP like me :)</p> ]]></content:encoded> </item> <item><title>By: Matt Moore</title><link>http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-67682</link> <dc:creator>Matt Moore</dc:creator> <pubDate>Tue, 31 Jan 2012 14:46:36 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-67682</guid> <description>Thank you soo much for this absolute life saver! i&#039;m currently converting our old site to PHP (after using HTML with CSS for so long) it got abit time consuming trying to flick through books which conveniently miss the PRINT function *palms own face*. I can&#039;t believe after hours of chewing through my code trying to decipher the simple way to produce the results it was something as small as that. 10 thumbs up!</description> <content:encoded><![CDATA[<p>Thank you soo much for this absolute life saver! i&#8217;m currently converting our old site to PHP (after using HTML with CSS for so long) it got abit time consuming trying to flick through books which conveniently miss the PRINT function *palms own face*. I can&#8217;t believe after hours of chewing through my code trying to decipher the simple way to produce the results it was something as small as that. 10 thumbs up!</p> ]]></content:encoded> </item> <item><title>By: John Ortiz</title><link>http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-65085</link> <dc:creator>John Ortiz</dc:creator> <pubDate>Fri, 02 Dec 2011 14:29:48 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-65085</guid> <description>Thank you for this.</description> <content:encoded><![CDATA[<p>Thank you for this.</p> ]]></content:encoded> </item> <item><title>By: portgaz</title><link>http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-61035</link> <dc:creator>portgaz</dc:creator> <pubDate>Wed, 27 Jul 2011 02:52:51 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-61035</guid> <description>Hi I already figured it out. I got the error because the host is set to localhost and not my local ip..
Cheers</description> <content:encoded><![CDATA[<p>Hi I already figured it out. I got the error because the host is set to localhost and not my local ip..</p><p>Cheers</p> ]]></content:encoded> </item> <item><title>By: portgaz</title><link>http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-61033</link> <dc:creator>portgaz</dc:creator> <pubDate>Wed, 27 Jul 2011 02:22:10 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-61033</guid> <description>Hi thanks for your code it really works. But i got an error when i try to use my own ip.
The error says,  &quot;Host &#039;comp.local&#039; is not allowed to connect to this MySQL server&quot;. Any ideas?
Thanks in advance</description> <content:encoded><![CDATA[<p>Hi thanks for your code it really works. But i got an error when i try to use my own ip.<br
/> The error says,  &#8220;Host &#8216;comp.local&#8217; is not allowed to connect to this MySQL server&#8221;. Any ideas?</p><p>Thanks in advance</p> ]]></content:encoded> </item> <item><title>By: grimdestripador@hotmail.com</title><link>http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-59604</link> <dc:creator>grimdestripador@hotmail.com</dc:creator> <pubDate>Tue, 24 May 2011 16:18:24 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-59604</guid> <description>Begin Quote: but i get an erorr of exceeding the time or long period more than 60 sec. End Quote.
You need to edit php.ini</description> <content:encoded><![CDATA[<p>Begin Quote: but i get an erorr of exceeding the time or long period more than 60 sec. End Quote.<br
/> You need to edit php.ini</p> ]]></content:encoded> </item> <item><title>By: Dawson</title><link>http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-58434</link> <dc:creator>Dawson</dc:creator> <pubDate>Wed, 27 Apr 2011 17:39:57 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-58434</guid> <description>Thanks! Worked perfectly.</description> <content:encoded><![CDATA[<p>Thanks! Worked perfectly.</p> ]]></content:encoded> </item> <item><title>By: dhirendra</title><link>http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-43986</link> <dc:creator>dhirendra</dc:creator> <pubDate>Mon, 05 Oct 2009 19:51:01 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-43986</guid> <description>i didn&#039;t get the solution of my problem. actually i&#039;ve created database on my own system and i want to connect it to my web host server so that every body who visits my site can access data from that database. is it possible? what could i have to do for that?</description> <content:encoded><![CDATA[<p>i didn&#8217;t get the solution of my problem. actually i&#8217;ve created database on my own system and i want to connect it to my web host server so that every body who visits my site can access data from that database. is it possible? what could i have to do for that?</p> ]]></content:encoded> </item> <item><title>By: Michael</title><link>http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-41215</link> <dc:creator>Michael</dc:creator> <pubDate>Wed, 15 Apr 2009 18:34:43 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-41215</guid> <description>Other than displaying  the value twice, this worked great for me!  Thanks</description> <content:encoded><![CDATA[<p>Other than displaying  the value twice, this worked great for me!  Thanks</p> ]]></content:encoded> </item> <item><title>By: sr</title><link>http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-41071</link> <dc:creator>sr</dc:creator> <pubDate>Mon, 06 Apr 2009 12:30:29 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/#comment-41071</guid> <description>hi i am trying to connect to my sql with this code
but i get an erorr of exceeding the time or long period more than 60 sec
would u help me</description> <content:encoded><![CDATA[<p>hi i am trying to connect to my sql with this code</p><p>but i get an erorr of exceeding the time or long period more than 60 sec</p><p>would u help me</p> ]]></content:encoded> </item> </channel> </rss>
