Jump to content

connection error???


NIPS

Recommended Posts

hi guys, just trying to display some information from my mysql database and have come across this error message.

"You don't have permission to access / on this server."

here is my code
[code]
<html>
<head>
<title>Magalluf Uncut</title>

</head>


<body>

<?php
// open connection to MySQL server
$connection = mysql_ connect('localhost', '12725', 'password') ~
or die ('Unable to connect!');

// select database for use
mysql_ select_ db('12725') or die ('Unable to select database!');

// create and execute query
$query = 'SELECT * FROM Bars';
$result = mysql_ query($ query) ~
or die ('Error in query: $query. ' . mysql_ error());


// check if records were returned
if (mysql_ num_ rows($ result) > 0)
{

// print HTML table
echo '<table width= 100% cellpadding= 10 cellspacing= 0 border= 1>';
echo
'<tr>< td>< b> ID</ b></ td>< td>< b> Name</ b></ td>< td>< b> Price</ b></ td></ tr>';
// iterate over record set
// print each field
while($ row = mysql_ fetch_ row($ result))
{
echo '<tr>';
echo '<td>' . $row[ 0] . '</td>';
echo '<td>' . $row[ 1] . '</td>';
echo '<td>' . $row[ 2] . '</td>';
echo '</tr>';
}
echo '</table>';
}
else
{
// print error message
echo 'No rows found!';
}
// once processing is complete
// free result set
mysql_ free_ result($ result);
// close connection to MySQL server
mysql_ close($ connection);
?>


</body>
</html>

[/code]

any help would be great!
Link to comment
https://forums.phpfreaks.com/topic/7039-connection-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.