Parse the php version of link_mysql. Copy the code as follows :? Php $ str_ SQL _readselectcount (*) asnumfromuserinfo; $ str_ SQL _deldeletefromuserinfowhereid1; $ reslink_mysql (read, $ str_ SQL _read); $ res _
The code is as follows:
$ 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_del = link_mysql ("delete", $ str_ SQL _del );
Echo $ res_del ."
";
While ($ row = mysql_fetch_assoc ($ res ))
{
Echo "". $ row ['num']."
";
}
?>
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;
}
?>
The http://www.bkjia.com/PHPjc/327991.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/327991.htmlTechArticle code is as follows :? 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 _...