MVC Improvement - The View Module - 0 * This simply pulls data from mysql and creates the html to be sent to the page.

class view_html extends database
  {
  function __construct($type)
    {
    parent::__construct();    
    switch ($type) 
      {
      case "bookmraks":
        $this-&gt;bookmarks();
        break;
      case "tweets":
        $this-&gt;tweets();
        break;
      default:
        echo "Invalid View Type";
        break;
      }
    }
  private function bookmarks()
    {
    $email = $_SESSION['email'];
    $query_return = database::query("SELECT * FROM bo  WHERE email='$email' ORDER BY name ASC");
    while ($ass_array = mysqli_fetch_assoc($query_return))
      {
      $fav=$this-&gt;fav($ass_array['url']);
      echo "&lt;img name=\"bo_im\" class=\"c\" src=\"$fav\"/ onerror=\"i_bm_err(this)\"&gt;&lt;a target=\"_blank\" name = \"a1\" class = \"b\" href = \"$ass_array[url]\"&gt;$ass_array[name]&lt;/a&gt;";
      }      
    }
  private function tweets() 
    {
    $query_return = database::query("SELECT * FROM tw ORDER BY time DESC LIMIT 7");
    $time = time();
    while ($a = mysqli_fetch_assoc($query_return))
      {
      echo  "&lt;div class=\"Bb2b\"&gt;&lt;img class=\"a\" src=\"p/$a[email].jpg\" alt=\"\"/&gt;&lt;a class=\"a\" href=\"javascript:void(0)\"&gt;$a[fname] posted &lt;script type=\"text/javascript\"&gt;document.write(v0($a[time],$time))&lt;/script&gt;&lt;/a&gt;&lt;br/&gt;&lt;p class=\"c\"&gt;$a[message]&lt;/p&gt;&lt;/div&gt;";
      }
    }
  private function fav($url)     
    {    
    $pieces = parse_url($url);    
    $domain = isset($pieces['host']) ? $pieces['host'] : '';    
    if(preg_match('/(?P&lt;domain&gt;[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs))       
      {     
      return $pieces['scheme'] . '://www.' . $regs['domain'] . '/favicon.ico';    
      }    
      return false;
    }
  }
Replace all usages of direct Values.

Try assiging values first to a named variable and then concating it, so its sustainable in the future like:

return $pieces['scheme'] . '://www.' . $regs['domain'] . '/favicon.ico';  


could be:

$protocol = $pieces['scheme'];
$domainName = $regs['domain'];
$faviconName = . '/favicon.ico';  
$favIconLink = $protocol. '://www.' .  $domainName . $faviconName
return  $favIconLink;


This would make it reusable and readable for other developers, and it reduces comments ;-) Currently you have many of them 

$fav=$this-&gt;fav($ass_array['url']);



I love regex, but once written nobody understands it:

if(preg_match('/(?P&lt;domain&gt;[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs))  


i would add a comment which explaines detailed what this regex is suppose to do. So if there is an Problem with the Regex everybody can check if the regex is doing it's job or if there is a problem in the expression.

Throw an exception in your constructor, so the errormessage can be cought. Now the error Message is displayed in the frontcode.

function __construct($type)
{
parent::__construct();    
switch ($type) 
  {
  case "bookmraks":
    $this-&gt;bookmarks();
    break;
  case "tweets":
    $this-&gt;tweets();
    break;
  default:
    throw new Exception('Invalid View Type');
  }
}


Last but not least:

try using "'" for strings, so its more readable and you make less errors by escaping not escaping closing, whatever

 '&lt;div class="Bb2b"&gt;&lt;img class="a" src="p/$a[email].jpg" alt=""/&gt;&lt;a class="a" href="javascript:void(0)"&gt;$a[fname] posted &lt;script type="text/javascript"&gt;document.write(v0($a[time],$time))&lt;/script&gt;&lt;/a&gt;&lt;br/&gt;&lt;p class="c"&gt;$a[message]&lt;/p&gt;&lt;/div&gt;'


instead of :

 "&lt;div class=\"Bb2b\"&gt;&lt;img class=\"a\" src=\"p/$a[email].jpg\" alt=\"\"/&gt;&lt;a class=\"a\" href=\"javascript:void(0)\"&gt;$a[fname] posted &lt;script type=\"text/javascript\"&gt;document.write(v0($a[time],$time))&lt;/script&gt;&lt;/a&gt;&lt;br/&gt;&lt;p class=\"c\"&gt;$a[message]&lt;/p&gt;&lt;/div&gt;"