Simple ticketing system Here is my simple ticketing system:

 &lt;?php
        session_start();
        session_id();
        ob_start();
        require("../configuration/config.php");
        $GetTickets = $con-&gt;query("SELECT * FROM tickets WHERE open='true'");
        if(!$_SESSION['Admin']) {
        header('Location: login.php'); exit();
        }
        ?&gt;
        &lt;!DOCTYPE HTML&gt;
        &lt;html&gt;
        &lt;head&gt;
            &lt;title&gt; ticketExpress | Admin &lt;/title&gt;
            &lt;link rel='stylesheet' href='../assets/css/style.css'&gt; 
        &lt;/head&gt;
        &lt;body&gt;
        &lt;div id='containerAdmin'&gt;
        &lt;h1&gt; &lt;img class='logo' src='../assets/images/logo.png' width='200' height='43'&gt; &lt;/h1&gt; &lt;a href='?logout' class='logout'&gt; Logout &lt;/a&gt;
        &lt;h3&gt; Open Tickets &lt;/h3&gt;
        &lt;hr /&gt;
        &lt;?php
        while($TicketInfo = $GetTickets-&gt;fetch_object()) {
        $Subject = $TicketInfo-&gt;Subject;
        if(strlen($Subject)&gt;50) {
            $Subject = substr($Subject,0,50)."...";
        } else {
        $Subject = $TicketInfo-&gt;Subject;
        }
        echo "&lt;div id='ticket'&gt;".$Subject ."&lt;a href='?delete=$TicketInfo-&gt;ID'&gt;&lt;img style='float:right'src='../assets/images/delete.png' width='15px' height='15px'&gt;&lt;/a&gt;&lt;a style='float:right; color:red; text-decoration:none; margin-right:10px;' href='?close=$TicketInfo-&gt;ID'&gt; Close &lt;/a&gt;&lt;span style='float:right; margin-right:10px;' id='responseMsg'&gt; &lt;/span&gt;&lt;/div&gt;";
        }
        if(isset($_GET['delete'])) {
        $ID = $_GET['delete'];
        echo "
        &lt;script type='text/javascript'&gt;
            var ajax = new XMLHttpRequest();
            ajax.open('POST','delete.php', true);
            ajax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
            ajax.onreadystatechange = function () {
                if(ajax.readyState == 4 &amp;&amp; ajax.status == 200) {
                    document.getElementById('responseMsg').innerHTML = ajax.responseText;
                }
                }
                ajax.send('delete=$ID');
            &lt;/script&gt;
            ";
        }
        if(isset($_GET['logout'])) {
        session_destroy();
        header('Location: login.php');
        }
        if(isset($_GET['close'])) {
        $ID = $_GET['close'];
        echo "
        &lt;script type='text/javascript'&gt;
            var ajax = new XMLHttpRequest();
            ajax.open('POST','close.php', true);
            ajax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
            ajax.onreadystatechange = function () {
                if(ajax.readyState == 4 &amp;&amp; ajax.status == 200) {
                    document.getElementById('responseMsg').innerHTML = ajax.responseText;
                }
                }
                ajax.send('close=$ID');
            &lt;/script&gt;
            ";
        }
        ?&gt;
        &lt;br /&gt;
        &lt;/div&gt;
        &lt;/body&gt;
        &lt;/html&gt;


Could you give me tips on improving the performance of my script? I've noticed that it takes some time to receive a response, so performance can definitely be further improved. I've been doing PHP for the last 8 months or so and am still a newbie.
A few quick tips: 


premature optimization is the root of all evil
use a profiling tool
premature optimization is the root of all evil
Don't echo markup, close php, write markup, open php tag again
premature optimization is the root of all evil
Dont query the DB, if you might have to change header('Location:...') a few lines further down. If you're going to have to redirect, do so ASAP.
premature optimization is the root of all evil
Avoid globals, they're error prone, hellish to debug and generally evil, but not as evil as premature optimization
premature optimization is the root of all evil


All in all, there's not enough code yet to squeeze any meaningful performance gain out of it. Not by altering the code alone, anyway.
If you do decide to use a profiling tool, also look into caching (google APC), and try your hand at bytecode caching. See how many ms you can shave off that way, but always remind yourself of one thing:


premature optimization is the root of all evil