Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8267643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:36:40+00:00 2026-06-08T05:36:40+00:00

So I’ve got some rows in a table that I want to use to

  • 0

So I’ve got some rows in a table that I want to use to concatenate. I also have a file that runs a query to count comments. I want to pull that number from that file.

I was doing it with straight html but my website is getting too big so I’m trying to make it dynamic with php and mysql.

So with my Html its hard coded and works:

<?php include_once("comments/post_title/tpost_title.php") ?>

So I thought I could just concatenate it to be the same, but for some reason my web browser (chrome) thinks its a comment.

Php:

$query  = "SELECT post_title FROM sessions";
$result = mysql_query($query);

while($row = mysql_fetch_assoc($result))

{
    echo "<a href=\"#" .strip_tags("{$row['post_title']}"). "\">read comment";
    echo "<?php include_once(\"comments/" .strip_tags("{$row['post_title']}")."/t". strip_tags("{$row['post_title']}"). ".php\") ?>";
    echo "</a>";
}

I’ve read about “@file_get_contents” but my understanding of it is limited. As I understand it has to be set to a variable and then I would have to insert that into my while loop. But I get lost in how the variable changes to the next row in my table to pull the next post_title.

I guess another option would be to put the query that’s in that file that counts comments into this loop, but then I’d have to put a variable into the query. (Is that “good” coding?) Say for instance:

$query  = "SELECT post_title FROM sessions WHERE session = 'variable';

Thanks in advance for the help and insight.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:36:41+00:00Added an answer on June 8, 2026 at 5:36 am

    To read the file in the loop, you need:

    while($row = mysql_fetch_assoc($result))
    {
        echo "<a href=\"#" .strip_tags("{$row['post_title']}"). "\">read comment";
    
        include_once("comments/" .strip_tags("{$row['post_title']}")."/t". strip_tags("{$row['post_title']}"). ".php");
        echo "</a>";
    }
    

    If the file you read isn’t PHP but straight HTML, then you can use readfile() instead of include(). The syntax is the same.

    To be sure, though, it would be better something like,

        $file = "comments/" .strip_tags("{$row['post_title']}")."/t". strip_tags("{$row['post_title']}"). ".php";
        if (file_exists($file))
            readfile($file);
        else
            echo "ERROR";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i want to parse a xhtml file and display in UITableView. what is the
I have a reasonable size flat file database of text documents mostly saved in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.