dblocation localhost dbname DB dbuser root dbpasswd dbcnx mysql_connec

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$dblocation = "localhost"; //
$dbname = "DB"; //
$dbuser = "root"; //??
$dbpasswd = ""; //???
$dbcnx = @mysql_connect($dblocation,$dbuser,$dbpasswd);
if (!$dbcnx) {
exit( "<P>???? ?? ?? ?????????</P>" );
}
if (! @mysql_select_db($dbname,$dbcnx) ) {
exit( "<P>???? ?? ??????????</P>" );
}
$query = "SELECT * FROM userslist ORDER BY name";
$usr = mysql_query($query);
if(!$usr) exit("??? ".mysql_error());
while($user = mysql_fetch_array($usr))
{
echo "<p>",$user[name];
}
echo "<p>";
$query = "SELECT * FROM userslist WHERE id = $_GET[id]";
$usr = mysql_query($query);
if(!$usr) exit("᪠ ".mysql_error());
$user = mysql_fetch_array($usr);
echo "<p>謿 ﮫ짮⠲嫿- $user[name]<p>";
if(!empty($user['email'])) echo "e-mail - $user[email]<p>";
if(!empty($user['url'])) echo "URL - $user[url]";
?>