代码如下:
502_3@PHP@H_502_3@$str_sql_read="select count(*) as num from userinfo";@H_502_3@$str_sql_del="delete from userinfo where id =1";@H_502_3@$res =link_MysqL("read",$str_sql_read);@H_502_3@$res_del =link_MysqL("delete",$str_sql_del);@H_502_3@echo $res_del."
";@H_502_3@while($row = MysqL_fetch_assoc($res))@H_502_3@{@H_502_3@echo "".$row['num']."
";@H_502_3@}
";@H_502_3@while($row = MysqL_fetch_assoc($res))@H_502_3@{@H_502_3@echo "".$row['num']."
";@H_502_3@}
?>
PHP@H_502_3@function link_MysqL($opt,$str_sql)@H_502_3@{@H_502_3@$con = MysqL_connect("localhost","root","root") or die ('Not connected : ' . MysqL_error());@H_502_3@MysqL_set_charset("gbk",$con);@H_502_3@//if you donot know how to use this function,find it defination;@H_502_3@MysqL_select_db("website",$con);@H_502_3@switch($opt){@H_502_3@case "read":@H_502_3@$res =MysqL_query($str_sql);@H_502_3@break;@H_502_3@case "update":@H_502_3@case "delete":@H_502_3@case "insert":@H_502_3@$res =MysqL_query($str_sql);@H_502_3@break;@H_502_3@}@H_502_3@MysqL_close();@H_502_3@return $res;@H_502_3@}@H_502_3@?>