我的问题是,当我在全局范围内使用 mysql 时,它可以工作,但在内部却不行,请看一下代码:
//connect.php
@mysql_connect($mysql_server, $mysql_admin, $mysql_pass);
@mysql_select_db($mysql_db);
//main.php
require_once("connect.php");
$rReq = $_REQUEST["req"];
function failed()
{
$qe = mysql_query("SELECT success_count FROM db WHERE serial='".$rReq."'");
$ro = mysql_fetch_row($qe);
$ro[0]+=1;
mysql_query("UPDATE db SET success_count = '".$ro[0]."' WHERE serial='".$rReq."'");
}
//main code
failed(); // not works, mysql_query does nothing
//if i put here the same code but outside the function it works :/
$qe = mysql_query("SELECT success_count FROM db WHERE serial='".$rReq."'");
$ro = mysql_fetch_row($qe);
$ro[0]+=1;
mysql_query("UPDATE db SET success_count = '".$ro[0]."' WHERE serial='".$rReq."'");