link_mysql的php版
添加时间:2013-7-1 点击量:
<?php
¥str_sql_read=" count() as num userinfo";
¥str_sql_del=" userinfo where id =1";
¥res =link_mysql("read",¥str_sql_read);
¥res_del =link_mysql("",¥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__db("website",¥con);
switch(¥opt){
case "read":
¥res =mysql_query(¥str_sql);
break;
case "":
case "":
case "":
¥res =mysql_query(¥str_sql);
break;
}
mysql_close();
return ¥res;
}
?>
容易发怒的意思就是: 别人做了蠢事, 然后我们代替他们, 表现出笨蛋的样子。—— 蔡康永
<?php
¥str_sql_read=" count() as num userinfo";
¥str_sql_del=" userinfo where id =1";
¥res =link_mysql("read",¥str_sql_read);
¥res_del =link_mysql("",¥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__db("website",¥con);
switch(¥opt){
case "read":
¥res =mysql_query(¥str_sql);
break;
case "":
case "":
case "":
¥res =mysql_query(¥str_sql);
break;
}
mysql_close();
return ¥res;
}
?>