<?php
$con
=@mysql_connect(
'localhost'
,
'root'
,
'root'
);
mysql_select_db(
'test'
,
$con
);
$userInfo
=mysql_query(
"select * from user"
,
$con
);
echo
"<table>"
;
while
(
$row
=mysql_fetch_assoc(
$userInfo
))
{
echo
"<tr>"
;
echo
"<td>"
;
echo
$row
[
'id'
];
echo
"</td>"
;
echo
"<td>"
;
echo
$row
[
'username'
];
echo
"</td>"
;
echo
"<td>"
;
echo
$row
[
'password'
];
echo
"</td>"
;
echo
"</tr>"
;
}
echo
"</table>"
;
mysql_free_result(
$userInfo
);
mysql_close(
$con
);
$u
=@mysql_connect(
'localhost'
,
'root'
,
'root'
);
mysql_select_db(
'test'
,
$u
);
mysql_query(
"update user set username='aaa' where username='00'"
,
$u
);
echo
"update user set username='ax' where id=2"
;
mysql_close(
$u
);
?>