时间:2021-07-01 10:21:17 帮助过:3人阅读
?>
function link_mysql($opt,$str_sql)
{
$con = mysql_connect("localhost","root","root") or die ('Not connected : ' . mysql_error());
mysql_set_charset("gbk",$con);
//if you donot know how to use this function,find it defination;
mysql_select_db("website",$con);
switch($opt){
case "read":
$res =mysql_query($str_sql);
break;
case "update":
case "delete":
case "insert":
$res =mysql_query($str_sql);
break;
}
mysql_close();
return $res;
}
?>
http://www.bkjia.com/PHPjc/327991.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/327991.htmlTechArticle 代码如下:?php $str_sql_read="select count(*) as num from userinfo"; $str_sql_del="delete from userinfo where id =1"; $res =link_mysql("read",$str_sql_read); $res_...