Jump to content


Photo

connection error???


  • Please log in to reply
4 replies to this topic

#1 NIPS

NIPS
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 10 April 2006 - 04:05 PM

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
<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>


any help would be great!

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 10 April 2006 - 04:55 PM

Its not a connection error. It meens you dont have permissions to view pages in your webs root directory. What server are you using?

#3 NIPS

NIPS
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 11 April 2006 - 11:09 AM

im using a free host which uses a linex server. any ideas??

#4 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 11 April 2006 - 02:09 PM

Are you sure php is installed?

#5 NIPS

NIPS
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 11 April 2006 - 03:12 PM

it should be as the free host supports php and offers phpadmin as a service.

it does say that "You should upgrade to PHP 4.1.0 or later" in the php admin section.

how do i know what version this php script is?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users