Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
php & MySQL connection...
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- php & MySQL connection...
php & MySQL connection...
22-04-2010 4:58 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Hi All, me again, the noob 
I'm trying to connect to my MySQL database and use a simple select statment but am getting the following error returned:
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
My php file looks like this :
<?php
$con = mysql_connect("localhost","username","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("username_pn", $con);
$result = mysql_query("SELECT * FROM subscriber");
while($row = mysql_fetch_array($result))
{
echo $row['FirstName'] . " " . $row['LastName'];
echo "<br />";
}
mysql_close($con);
?>
I think its the 'localhost' parameters.
Can anybody shed any light on this?
Many thanks.

I'm trying to connect to my MySQL database and use a simple select statment but am getting the following error returned:
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
My php file looks like this :
<?php
$con = mysql_connect("localhost","username","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("username_pn", $con);
$result = mysql_query("SELECT * FROM subscriber");
while($row = mysql_fetch_array($result))
{
echo $row['FirstName'] . " " . $row['LastName'];
echo "<br />";
}
mysql_close($con);
?>
I think its the 'localhost' parameters.
Can anybody shed any light on this?
Many thanks.
Message 1 of 2
(855 Views)
1 REPLY 1
Re: php & MySQL connection...
22-04-2010 6:20 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
When you activated MySQL you should have received an email giving the server name (rumpus or humbug), username and password.
jelv (a.k.a Spoon Whittler) Why I have left Plusnet (warning: long post!) Broadband: Andrews & Arnold Home::1 (FTTC 80/20) Line rental: Pulse 8 Home Line Rental (£14.40/month) Mobile: iD mobile (£4/month) |
Message 2 of 2
(227 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- php & MySQL connection...