Blogger Information
Blog 35
fans 0
comment 0
visits 27629
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
如何连接数据库服务器
小的博客
Original
819 people have browsed it
<?php
 header('Content-Type:text/html;charset=utf-8');
 define('DB_HOST','localhost');
 define('DB_USER','root'); 
 define('DB_PASS','root');
  define('DB_CHAR','utf8'); 
  $db=@mysql_connect(DB_HOST,DB_USER,DB_PASS); 
  if(!$db){  
       echo die('Could not connect'.mysql_error()); 
     }else{ 
         mysql_select_db('demo');    
         $sql='SELECT * FROM user';    
         $res=mysql_query($sql,$db);   
         $num=mysql_num_rows($res);    
         var_dump($num);    
         echo '<table border="1" cellpadding="0" cellspacing="0" width="800">';  
           echo '<tr>';    
           echo '<th>ID</th>';    
           echo '<th>name</th>';    
           echo '<th>password</th>';  
           echo '<th>email</th>';   
            echo '<th>mobbile</th>';    
            echo '<th>img</th>';    
            echo '</tr>';    
            while($res1=mysql_fetch_assoc($res)){     
            echo '<tr>';     
            echo  '<td>'.$res1["id"].'</td>';    
            echo  '<td>'.$res1["name"].'</td>';    
             echo '<td>'.$res1["password"].'</td>';     
             echo '<td>'.$res1["email"].'</td>';     
             echo '<td>'.$res1["mobbile"].'</td>';    
              echo '<td><img src='.$res1["img"].' width="60"></td>';    
               echo '</tr>';   
                }    
                echo '</table>'; 
                }
 ?>
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post