class - tweet - 0 - to_do This class sends "tweet" data to the client in the form of a custom markup language.  How can it be improved?

It is used in Ajax call and in previous post people have suggested not to echo the result..but this is my primary means of communicating with the server via Ajax responseText.

Also &lt;tw_p&gt; is used to denote a pass and is read by the client.  The markup looks like this.

field 1 | field 2 | field 3 | field 4 || field 1 | field 2 | field 3 | field 4 ||

It is called like this - 

new tweet();


The client knows how render this into xhtml once it receives it.

/*tweet*/

class tweet extends post
  {
  function __construct()
    {
    parent::__construct();
    $email=$_SESSION['email'];
    $flname=$_SESSION['name'];
    $message=$this-&gt;_protected_arr['f4b'];
    $time=time();
    database::query("INSERT INTO tw VALUES ('$time','$flname','$message','$email')");        
    $query_return = database::query("SELECT * FROM tw ORDER BY time DESC LIMIT 7");
    $b=0;
    $c='&lt;tw_p&gt;';
    while($a=mysqli_fetch_assoc($query_return))
      {  
      if($b==0)
        {
        $c = $c . $a['email'] . "|" .  $a['fname'] . "|" . $a['time'] . "|" . $time . "|" . $a['message'];
        }
      else
        {
        $c = $c . "||" . $a['email'] . "|" .  $a['fname'] . "|" . $a['time'] . "|" . $time . "|" . $a['message'];
        }
      $b++;
      }
    echo $c;
    }
  }
So, this is the PHP that causes you to have your 'aml' processing here.

I think people must have confused you by saying not to echo.  You are correct, you do have to communicate by printing something out.  The best way to communicate with Javascript is by using JSON.  JSON stands for JavaScript Object Notation.

You should also check for success or failure from the database query.  Below is untested code (I have no idea what your database::query returns so my error check may not be appropriate):

$query_return = database::query("SELECT * FROM tw ORDER BY time DESC LIMIT 7");

if ($query_return === false)
{
    echo json_encode(array('Success' =&gt; false));
    return;
}   

$results = array('Data'    =&gt; array(),
                 'Success' =&gt; true);

while($row = mysqli_fetch_assoc($query_return))
{  
    $results['Data'][] = $row;
}

echo json_encode($results);


So now you will receive an array of rows from your database that your javascript code can deal with nicely.  It will be a valid javascript object so you can check it with:

if (response.Success)
{
    // Do stuff with response.Data here.  Probably a loop over the results.
}