源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

解析link_mysql的php版

  • 时间:2022-09-17 18:07 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:解析link_mysql的php版
[u]复制代码[/u] 代码如下:
<?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_del =link_mysql("delete",$str_sql_del); echo $res_del."<br/>"; while($row = mysql_fetch_assoc($res)) {  echo "<font style='font-size:25px;color:red;'>".$row['num']."</font><br/>"; } ?> <?php 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; } ?>
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部