Monday, September 13, 2010

Print Mysql Database Structure Using PHP

 <?php  
 $HOSTNAME          = 'localhost';  
 $USERNAME          = 'root';  
 $PASSWORD          = '';  
 $DBNAME               = 'rizvi_test_db';  
  mysql_select_db($DBNAME, mysql_connect($HOSTNAME, $USERNAME, $PASSWORD)) or die(mysql_error());   
  $result = mysql_query("SHOW TABLES;") or die(mysql_error());   
   while($row = mysql_fetch_array($result)){  
  echo $row[0]; //print the table name  
  $result2 = mysql_query("DESCRIBE ".$row[0].";") or die(mysql_error()); //get details schema for each table  
  echo "<table border='1' width='70%'>";  
  echo "<tr><td>Field</td><td>Type</td><td>Null</td><td>Key</td><td>Default</td><td>Extra</td>";  
  while($row2 = mysql_fetch_array($result2)){  
  for($i=0; $i<6; $i++){   
   if($row2[$i] == "" || $row2[$i] == NULL){  
   $row2[$i] = " ";  
   }  
  }    
  echo "<tr>";  
  echo "<td>".$row2[0]."</td><td>".$row2[1]."</td><td>".$row2[2]."</td><td>".$row2[3]."</td><td>".$row2[4]."</td><td>".$row2[5];  
  echo "</tr>";  
  }  
  echo "</table>";   
  echo "<br/>";  
 }  
 ?>  

Wednesday, September 01, 2010

How to remove mootools.js and caption.js from Joomla1.5 ?



 
 
  <script type="text/javascript" src="/media/system/js/mootools.js"></script>  
  <script type="text/javascript" src="/media/system/js/caption.js"></script>  
To remove above javascript's import, you just need to 
add the following code at the top of your template's index.php file.
 <?php   
           //remove mootools.js and caption.js  
           $headerstuff=$this->getHeadData();  
           reset($headerstuff['scripts']);  
           foreach($headerstuff['scripts'] as $key=>$value){  
            unset($headerstuff['scripts'][$key]);  
           }            
           $this->setHeadData($headerstuff);  
 ?>