Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Unknown error

Codes here !

Moderators: macek, egami, gesf

Unknown error

Postby RobberBaron » Tue Mar 26, 2013 4:32 am

Okay, the basic idea: I've had to import some SQL data from my website into an XAMPP hosted phpMyAdmin on my computer. I've written a small script to output the information on a webpage, however I'm getting a strange error:
Code: Select all
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

Fatal error: Unknown: Failed opening required '/Applications/XAMPP/xamppfiles/htdocs/robberbaron/forum.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php:/Applications/XAMPP/xamppfiles/lib/php/pear') in Unknown on line 0


The script I'm using is:
Code: Select all
<html><head><title>Forum Data</title></head><body>
<h1>Forum</h1>
<hr />
<?php
$con=mysql_connect('localhost', 'root', '') or print(mysql_error());
$db=mysql_select_db('forum', $con) or print(mysql_error());
$q=mysql_query("SELECT * FROM thread");
while ($arr=mysql_fetch_array($q);) {
    print "<h3>".$arr['threadid'].": ".$arr['title']." by ".$arr['postusername'}."</h3><br />";
?>
<table border="1">
<tr><th>Id</th><th>User</th><th>Content</th></tr>
<?php
    $c=mysql_query("SELECT * FROM post WHERE threadid = ".$arr['threadid']);
    while($post=mysql_fetch_array($c)){
        print "<tr><td>".$post['postid']."</td><td>".$post['username']."</td><td>".bbcode_parse($post['pagetext'])."</td></tr>";
    }
}
?>
</table>
</body>
</html>


Any clues?
RobberBaron
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Mar 26, 2013 4:28 am

Re: Unknown error

Postby RobberBaron » Tue Mar 26, 2013 4:36 am

I tried moving the file to a directory which I'm certain can be accessed, and yet it still has an identical error
RobberBaron
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Mar 26, 2013 4:28 am

Re: Unknown error

Postby seandisanti » Thu Mar 28, 2013 11:40 pm

What operating system are you using? if you're on a nix, you probably have to chmod or chown the relevant directories to make sure that apache has access.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.