所以我的 php 脚本中有一堆这样的:
//get current values to add to new ones
$sql = "SELECT `pageViews` FROM $table WHERE `appName` = '$appName'";
$result = mysql_query($sql);
if (!$result) {
die("Invalid query: " .mysql_error());
}
$totalPoints += mysql_result($result, 0, 0);
//get current values to add to new ones
$sql = "SELECT `appTime` FROM $table WHERE `appName` = '$appName'";
$result = mysql_query($sql);
if (!$result) {
die("Invalid query: " .mysql_error());
}
$appRunTime += mysql_result($result, 0, 0);
//get current values to add to new ones
$sql = "SELECT `soundsPlayed` FROM $table WHERE `appName` = '$appName'";
$result = mysql_query($sql);
if (!$result) {
die("Invalid query: " .mysql_error());
}
$lifesLost += mysql_result($result, 0, 0);
是否可以将所有这些查询组合成一个并仍然检索每个单独的信息,即将它们设置为一个变量?
谢谢。