0

I am getting this error and i cant seem to figure out why

Warning: file_get_contents(C:/xampp/htdocs) [function.file-get-contents]: failed to open stream: Permission denied in C:\xampp\htdocs\ucuk\news.php on line 157

heres my code

<?php
        // Build SQL Query  
        $query = ("SELECT * FROM heading LEFT JOIN sub_heading ON heading.heading_id = sub_heading.month"); // SQL query
        $string = mysql_query($query) or die (mysql_error());
        $totalRows = mysql_num_rows($string);
    ?>
    <?php
    $resource = mysql_query($query);
    $previous_heading = false;
    
    // This will print the headings in a unordered list, modify if needed
    while($resource = mysql_fetch_assoc($string)) {
        if(!$previous_heading || $previous_heading != $resource['heading']) {
            if($previous_heading) {
            }
            echo $resource['heading'];
        }
    ?>
    <?php if ($totalRows > 0) { // Show if recordset not empty ?>
        <div id="report">
    <?php echo $resource['title']; ?>
    
    <img id="reportimg" src="..<?php echo $resource['img']; ?>" />
    
    <?php
        $file = $_SERVER['DOCUMENT_ROOT'] . $resource['txt'];
        $contents = file_get_contents($file);
        print $contents;
        $previous_heading = $resource['heading'];
    ?>
        </div>
    <?php } // Show if recordset not empty ?>
    <?php } // Close the while statement ?>
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by nonshatter
0

"Permission denied" means that the file that you're trying to read from is protected somehow. Check the properties of that file or directory

C://xampp/htdocs/ $resource['txt'].
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.