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

  • SEARCH
  • Home
  • 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 7847789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:00:10+00:00 2026-06-02T18:00:10+00:00

UPDATED PHP Seems to be something to do with Angle brackets… My first time

  • 0

UPDATED PHP

Seems to be something to do with Angle brackets…

My first time coding my own PHP and SQL, but having a bit of trouble, so not even plugged HTML in yet. I’d imagine I’m not escaping something right, or my formatting is miles off… or something REALLY simple.

I’m basically trying to get a list of events working, and many posts on it here, just can’t put them all together to get a result.

So I’m looking for

YEAR

MONTH
EVENT

MONTH
EVENT
EVENT

YEAR etc

My HTML looks like this…

<div id="year">
<p class="vert">YEAR</p>
    <div id="month">
        <h1>MONTH</h1>
        <div class="event">
            <p>DATE START - DATEEND IF DIFFERENT/AVAILABLE</p>
            <div class="eventmain">
                <img class="flag" src="./img/defaultflag.png">
                <img class="open" src="./img/plus.png">
                <img class="close" src="./img/minus.png">
                <h2> Event Name </h2>
                <div class="eventdetails">
                    <p>FORMAT</p>
                    <p>INFO</p>
                    <p>CONTACT</p>
                    <p>EMAIL</p>
                    <p>WEBSITE</p>
                </div> <!-- close div event details -->
            </div> <!-- close div event main -->
        </div> <!-- close div event -->
    </div> <!-- close div month -->
</div> <!--close div year-->

With the following DB fields in the DB debate_calendar, table events
event_name, event_startdate, event_enddate, event_flag, event_format, event_info,event_contactinfo, event_email, event_website, event_reg

I have the following PHP

<?php

$server = "localhost:8889";
$user = "root";
$passwd = "root";
$db_name = "debate_calendar";
$table_name = "events";

$conn = mysql_connect($server, $user, $passwd) or die("Couldn't connect to SQL Server on $server"); 
mysql_select_db($db_name, $conn);

    if (!$conn)
        {
        exit("Failed to Connect to $dbConnection");
        } 
    else
        {
        echo "Database Connected";
        }

$query = "SELECT * FROM `debate_calendar`.`events` WHERE event_date > NOW() ORDER BY event_date DESC";
$result = mysql_query( $query );

    $current_month = '';
    $current_year = '';

    while ($event = mysql_fetch_assoc($result)) {
         $year = date('y', $event['event_startdate']);
        if($current_year != $year) 
            {
                $current_year = $year;
                echo ("<h1>" .$current_year. "</h1>");
            }           
        $month = date('m', $event['event_startdate']);
        if($current_month != $month) 
            {
                $current_month = $month;
                echo '<h2>' . $current_month . '</h2>';
            }
        echo '<p>' . $event['event_name'] . '</p>';
    }   
        mysql_close($con);
?> 

But all it’s generating is…

NOW() ORDER BY event_date DESC"; $result = mysql_query( $query ); $current_month = ''; $current_year = ''; while ($event = mysql_fetch_assoc($result)) { $year = date('y', $event['event_startdate']); if($current_year != $year) { $current_year = $year; echo ("
" .$current_year. "
"); } $month = date('m', $event['event_startdate']); if($current_month != $month) { $current_month = $month; echo '
' . $current_month . '
'; } echo '

' . $event['event_name'] . '
'; } mysql_close($con); ?> 
  • 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-02T18:00:12+00:00Added an answer on June 2, 2026 at 6:00 pm

    The answer was a schoolboy error.

    I had moved the site from one MAMP install to a fresh one,
    where the htaccess hadn’t been changed to allow html files to be opened as PHP.

    Still lots of errors in the code, but this was the underlying problem

    Simple as that!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I display the last time the current document was updated in PHP?
I've updated php.ini and moved php_mysql.dll as explained in steps 6 and 8 here.
I just updated PHP 5.2.0 to 5.2.11 and now I am getting loads of
I've got a web server running IIS7 and I just updated to PHP 5.3.
( Updated a little ) I'm not very experienced with internationalization using PHP, it
I'm trying to create an SQL query in PHP to update a table. Is
I'm usually a PHP guy but got stuck doing a project in vb.net. I
I have a fair bit of experience with PHP frameworks and Python for scripting
I'm a PHP dev and I'm new to Rails but have been getting on
I'm attempting to echo a PHP variable into my script, however it seems to

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.