<?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: PHP not connecting to a MySQL database server</title> <atom:link href="http://www.cyberciti.biz/faq/php-not-connecting-to-a-mysql-database-server/feed/" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/faq/php-not-connecting-to-a-mysql-database-server/</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: saeed</title><link>http://www.cyberciti.biz/faq/php-not-connecting-to-a-mysql-database-server/#comment-48323</link> <dc:creator>saeed</dc:creator> <pubDate>Sun, 11 Jul 2010 06:56:01 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/faq/php-not-connecting-to-a-mysql-database-server.php#comment-48323</guid> <description>I have IIS Web server and MySQL configured. Everything works fine except I am not able to connect to a MySQL database server by PHP (I am able to connect mysql server with mysql client and with Java but not with PHP). So how do I configure or connect PHP scripts?</description> <content:encoded><![CDATA[<p>I have IIS Web server and MySQL configured. Everything works fine except I am not able to connect to a MySQL database server by PHP (I am able to connect mysql server with mysql client and with Java but not with PHP). So how do I configure or connect PHP scripts?</p> ]]></content:encoded> </item> <item><title>By: Temitope</title><link>http://www.cyberciti.biz/faq/php-not-connecting-to-a-mysql-database-server/#comment-46941</link> <dc:creator>Temitope</dc:creator> <pubDate>Mon, 19 Apr 2010 11:58:12 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/faq/php-not-connecting-to-a-mysql-database-server.php#comment-46941</guid> <description>pls what is wrong with this code, i want to create a mysql table from php in that the user has already specified the table name ,field lenght etc
but rthe code refused to connect to mysql datase, hence didnt produce the result i want!
Apache 2.2.11
Php 5.3.0
mysql 5.1.36
and im using windows xp as my operating system
The Code:
Create A Database Table:STep 3
Adding table
&lt;pre&gt;
&lt;?php
//create connection
$username=&quot;reborn&quot;;
$password=&quot;reborn&quot;;
$hostname=&quot;localhost&quot;;
$connection = mysql_connect($hostname, $username, $password)
or die(&quot;Cudn&#039;t Connect To Server&quot;);
echo &quot;Connected To MySQL&quot;;
$sql=&quot;CREATE TABLE $table_name (&quot;;
for($i=0;$i &lt; count($field_name);$i++)
{
$sql.= &quot;$field_name[$i] $field_type[$i]&quot;;
if($field_length[$i] !=&quot; &quot;)
{
$sql.= &quot;($field_length[$i]),&quot;;
}
else{
$sql .=&quot;,&quot;;
}
}
$sql=sbstr($sql,0,-1);
$sql .=&quot;)&quot;;
//select database
$db = mysql_select_db(&quot;reborndb&quot;,$connection)
or die (&quot;Cudn&#039;t select database&quot;);
//execute SQL query and get result!
$sql_result=mysql_query($sql,$connection)
or die (&quot;Cudn&#039;t execute query.&quot;);
if(!$sql_result)
{
echo&quot;Cudn&#039;t Create Table!&quot;;
} else{
echo&quot;$table_name has created!&quot;;
}
?&gt;
&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>pls what is wrong with this code, i want to create a mysql table from php in that the user has already specified the table name ,field lenght etc<br
/> but rthe code refused to connect to mysql datase, hence didnt produce the result i want!<br
/> Apache 2.2.11<br
/> Php 5.3.0<br
/> mysql 5.1.36<br
/> and im using windows xp as my operating system</p><p>The Code:</p><p>Create A Database Table:STep 3</p><p>Adding table</p><pre>
&lt;?php
//create connection
$username=&quot;reborn&quot;;
$password=&quot;reborn&quot;;
$hostname=&quot;localhost&quot;;
$connection = mysql_connect($hostname, $username, $password)
or die(&quot;Cudn&#039;t Connect To Server&quot;);
echo &quot;Connected To MySQL";
$sql="CREATE TABLE $table_name (";
for($i=0;$i &lt; count($field_name);$i++)
{
$sql.= &quot;$field_name[$i] $field_type[$i]&quot;;
if($field_length[$i] !=&quot; &quot;)
{
$sql.= &quot;($field_length[$i]),&quot;;
}
else{
$sql .=&quot;,&quot;;
}
}
$sql=sbstr($sql,0,-1);
$sql .=&quot;)&quot;;
//select database
$db = mysql_select_db(&quot;reborndb&quot;,$connection)
or die (&quot;Cudn&#039;t select database&quot;);
//execute SQL query and get result!
$sql_result=mysql_query($sql,$connection)
or die (&quot;Cudn&#039;t execute query.&quot;);
if(!$sql_result)
{
	echo&quot;Cudn't Create Table!";
} else{
	echo"$table_name has created!";
}
?&gt;
</pre>]]></content:encoded> </item> <item><title>By: kuldeep singh</title><link>http://www.cyberciti.biz/faq/php-not-connecting-to-a-mysql-database-server/#comment-45005</link> <dc:creator>kuldeep singh</dc:creator> <pubDate>Thu, 03 Dec 2009 18:05:22 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/faq/php-not-connecting-to-a-mysql-database-server.php#comment-45005</guid> <description>hi i m new user to ubuntu.i could not connect to mysql server through php.
i have installed php5 ,mysql server ,apache server.
somebody can help me?????</description> <content:encoded><![CDATA[<p>hi i m new user to ubuntu.i could not connect to mysql server through php.<br
/> i have installed php5 ,mysql server ,apache server.<br
/> somebody can help me?????</p> ]]></content:encoded> </item> <item><title>By: viji</title><link>http://www.cyberciti.biz/faq/php-not-connecting-to-a-mysql-database-server/#comment-44644</link> <dc:creator>viji</dc:creator> <pubDate>Fri, 13 Nov 2009 05:49:57 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/faq/php-not-connecting-to-a-mysql-database-server.php#comment-44644</guid> <description>why this error message in happens:
Could not connect: Access denied for user &#039;sss&#039;@&#039;localhost&#039; (using password: YES)</description> <content:encoded><![CDATA[<p>why this error message in happens:<br
/> Could not connect: Access denied for user &#8216;sss&#8217;@'localhost&#8217; (using password: YES)</p> ]]></content:encoded> </item> <item><title>By: jayendra</title><link>http://www.cyberciti.biz/faq/php-not-connecting-to-a-mysql-database-server/#comment-42396</link> <dc:creator>jayendra</dc:creator> <pubDate>Sun, 05 Jul 2009 20:26:05 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/faq/php-not-connecting-to-a-mysql-database-server.php#comment-42396</guid> <description>I am using wamp server and netbeans ide to write php. I am new to php development. I am not able to connect mysql to php. I don&#039;t know what is happening? I am not able to insert data into mysql.</description> <content:encoded><![CDATA[<p>I am using wamp server and netbeans ide to write php. I am new to php development. I am not able to connect mysql to php. I don&#8217;t know what is happening? I am not able to insert data into mysql.</p> ]]></content:encoded> </item> <item><title>By: rishi</title><link>http://www.cyberciti.biz/faq/php-not-connecting-to-a-mysql-database-server/#comment-40099</link> <dc:creator>rishi</dc:creator> <pubDate>Mon, 02 Feb 2009 19:12:39 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/faq/php-not-connecting-to-a-mysql-database-server.php#comment-40099</guid> <description>i have my own domain and webserver i cant understand that why connection cannot be made to database of mysql with php</description> <content:encoded><![CDATA[<p>i have my own domain and webserver i cant understand that why connection cannot be made to database of mysql with php</p> ]]></content:encoded> </item> <item><title>By: Bill Brinegar</title><link>http://www.cyberciti.biz/faq/php-not-connecting-to-a-mysql-database-server/#comment-39965</link> <dc:creator>Bill Brinegar</dc:creator> <pubDate>Thu, 22 Jan 2009 23:19:53 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/faq/php-not-connecting-to-a-mysql-database-server.php#comment-39965</guid> <description>I reat the following message and am having the same problem.  I used XAMPP to install the group for windows vista.  I have also installed them individually for the internet and also from a disk I got from a SAMs book.
I have Apache Web server and MySQL configured. Everything works fine except I am not able to connect to a MySQL database server (I am able to connect mysql server with mysql client). So how do I configure or connect PHP scripts?
I don&#039;t understand the following answer, do I need to re-install MySQL  or can I modify it?  I would like to get all of them installed and be able to use mysqli functionality.
I have followed all of the different install proceedures and still can not get it to worl.
A. You need to install MySQL module for php4 or php5. Without php-mysql shared object or module, php scripts won&#039;t able to connect to MySQL database server.</description> <content:encoded><![CDATA[<p>I reat the following message and am having the same problem.  I used XAMPP to install the group for windows vista.  I have also installed them individually for the internet and also from a disk I got from a SAMs book.</p><p> I have Apache Web server and MySQL configured. Everything works fine except I am not able to connect to a MySQL database server (I am able to connect mysql server with mysql client). So how do I configure or connect PHP scripts?</p><p>I don&#8217;t understand the following answer, do I need to re-install MySQL  or can I modify it?  I would like to get all of them installed and be able to use mysqli functionality.</p><p>I have followed all of the different install proceedures and still can not get it to worl.</p><p>A. You need to install MySQL module for php4 or php5. Without php-mysql shared object or module, php scripts won&#8217;t able to connect to MySQL database server.</p> ]]></content:encoded> </item> <item><title>By: rajesh</title><link>http://www.cyberciti.biz/faq/php-not-connecting-to-a-mysql-database-server/#comment-37192</link> <dc:creator>rajesh</dc:creator> <pubDate>Thu, 20 Dec 2007 16:25:56 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/faq/php-not-connecting-to-a-mysql-database-server.php#comment-37192</guid> <description>I m not able to connect localhost. error 3306</description> <content:encoded><![CDATA[<p>I m not able to connect localhost. error 3306</p> ]]></content:encoded> </item> </channel> </rss>
