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

        // 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);
    $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']; ?>" />
        $file = $_SERVER['DOCUMENT_ROOT'] . $resource['txt'];
        $contents = file_get_contents($file);
        print $contents;
        $previous_heading = $resource['heading'];
    <?php } // Show if recordset not empty ?>
    <?php } // Close the while statement ?>

"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'].
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.