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 8934099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:42:20+00:00 2026-06-15T09:42:20+00:00

I have noticed this is a common error in php and i tried to

  • 0

I have noticed this is a common error in php and i tried to search the net and i can not get my answer, I am trying to create a simpe forum and I am getting these errors

Notice: Undefined variable: topics in C:\xampp\htdocs\mysite\Students forum\view_category.php on line 83

Notice: Undefined variable: topic in C:\xampp\htdocs\mysite\Students forum\view_category.php on line 86

and this is the code on line 83

$topics .= "<table width='100%' style='border-collapse: collapse;'>";

and this is the code on line 86

$topic .= "<tr><td colspan='4'><hr /></td></tr>";

and this is my code

if (mysql_num_rows($res2) > 0) {
        // Appending table data to the $topics variable for output on the page
        $topics .= "<table width='100%' style='border-collapse: collapse;'>";
        $topics .= "<tr><td colspan='4'><a href='index.php'>Return To Forum Index</a>".$logged."<hr /></td></tr>";
        $topics .= "<tr style='background-color: #dddddd;'><td>Topic Title</td><td width='65' align='center'>Last User</td><td width='65' align='center'>Replies</td><td width='65' align='center'>Views</td></tr>";
        $topic .= "<tr><td colspan='4'><hr /></td></tr>";
        // Fetching topic data from the database
        while ($row = mysql_fetch_assoc($res2)) {
            // Assign local variables from the database data
            $tid = $row['id'];
            $title = $row['topic_title'];
            $views = $row['topic_views'];
            $date = $row['topic_date'];
            $creator = $row['topic_creator'];
            // Check to see if the topic has every been replied to
            if ($row['topic_last_user'] == "") { $last_user = "N/A"; } else { $last_user = getusername($row['topic_last_user']); }
            // Append the actual topic data to the $topics variable
            $topics .= "<tr><td><a href='view_topic.php?cid=".$cid."&tid=".$tid."'>".$title."</a><br /><span class='post_info'>Posted by: ".getusername($creator)." on ".convertdate($date)."</span></td><td align='center'>".$last_user."</td><td align='center'>".topic_replies($cid, $tid)."</td><td align='center'>".$views."</td></tr>";
            $topics .= "<tr><td colspan='4'><hr /></td></tr>";
        }
        $topics .= "</table>";
        // Displaying the $topics variable on the page
        echo $topics;
    } 
  • 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-15T09:42:21+00:00Added an answer on June 15, 2026 at 9:42 am

    The operator .= is typically used for concatenation of the right and left argument, but in this case, you do not have a left argument. You must instantiate the variable like so:

    $topics = "<table width='100%' style='border-collapse: collapse;'>";
    $topic = "<tr><td colspan='4'><hr /></td></tr>";
    
    if( ... ) {
        while( ... ) {
            $topics .= ...
            $topic .= ...
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question may not directly relate to programming. I have noticed that the technology
I have this error NOTICE: UNDEFINED VARIABLE: LOGO IN C:\WAMP\WWW\SITE\TOOLS\SMARTY\SYSPLUGINS\SMARTY_INTERNAL_DATA.PHP ON LINE 291 CALL
I have noticed while monitoring/attempting to answer common jQuery questions, that there are certain
I have slime with sbcl working in emacs 24.1 but can not get a
I have noticed a number of kernel sources that look like this (found randomly
I'm new to jQuery and have noticed someone go: var $this = $(this); Why
I noticed that some stylesheets have something like this: body { font-size: 62.5%/1.2em; }
I have never come across this issue but most recently I noticed that a
I just noticed something strange. If I have this XML: <level number=7 background=background_5> and
I have a multithreaded application. However I noticed, I'm using OpenGL and this should

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.