<?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>';
}
?>
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号