- 论坛徽章:
- 0
|
求助~~~急死了!网页操作后,数据库中没反应~~~
[quote]原帖由 "yb0312"][/quote 发表:
多谢楼上的兄弟!
我刚接触这个还不熟,能给个例子吗?
或者哪位能帮我看看这个用法及解释对不对?多谢!
[root@localhost phptests]# cat UserInfo.php
<?
$connect = mysql_pconnect("localhost","root","mypassword" ;
mysql_select_db("MYLOGIN", $connect);
if ($UserName)
{
$query = "select * from UserInfo";
$result = mysql_query($query);
$rows = @mysql_num_rows($result);
$a_row = @mysql_affected_rows($result);
$id = 0;
for($i=0; $i<$rows; $i++)
{
@mysql_data_seek($result, $i);
$data = @mysql_fetch_array($result);
if ($data[Id] >; $id)
{
$id = $data[Id];
}
}
//向数据库中添加记录
$id++;
$query = "insert into UserInfo values('".$id."','".$UserName."','".$Password;
$query = $query."','".$Name."')";
echo "$query";
$result = mysql_query($query);
}
mysql_close($connect);
?>;
这是程序.我理解data数组中应该是data[Id],data[UserName],data[Password],data[Name]. |
|