Jump to content

Archived

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

NIPS

connection error???

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!

Share this post


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

Share this post


Link to post
Share on other sites
im using a free host which uses a linex server. any ideas??

Share this post


Link to post
Share on other sites
Are you sure php is installed?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

×

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.