note 42879 deleted from install.openbsd by vincent
| From: | vincent@php.net | Date: | Wed, 09 Jun 2004 10:51:39 +0000 |
| Subject: | note 42879 deleted from install.openbsd by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-70645@lists.php.net to get a copy of this message | ||
Note Submitter: zamzurix.saad@intel.com
----
I test the php with the sql using script below:
note:mysql_host = localhost
mysql_password = password
mysql_user = netoffice
my_database = netoffice
<?php
/* Connecting, selecting database */
$link = mysql_connect("mysql_host", "mysql_user", "mysql_password")
or die("Could not connect : " . mysql_error());
echo "Connected successfully";
mysql_select_db("my_database") or die("Could not select database");
/* Performing SQL query */
$query = "SELECT * FROM my_table";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
/* Printing results in HTML */
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
/* Free resultset */
mysql_free_result($result);
/* Closing connection */
mysql_close($link);
?>
Then when I open this site, it will show the sql error below:
Could not connect : Can't connect to local MySQL server through socket
'/var/run/mysql/mysql.sock' (2)
I hope this issue can help others beigetower member too.