如何选择MAX(updateTag)
我使用时间戳记updateTag列创建digiCardPass。 我尝试:如何选择MAX(updateTag)
$query1 = mysql_query("select MAX(updateTag) as updateTag from digiCardPass");
$row1 = mysql_fetch_array($query1);
$updateTag = $row1['updateTag'];
error_log("max updateTag:",$updateTag,0);
但我不能在php_error.log得到这个错误:
[03月 - 2013 12时46分06秒亚洲/金边] PHP的通知:非形成良好在 /Applications/MAMP/htdocs/passesWebserver/createPass/index.php遇到上线 数值 42 [03月 - 2013 12时46分06秒亚洲/金边]最大updateTag:
//line 42: error_log("max updateTag:",$updateTag,0);
如何解决这个问题?
您的error_log语句不正确,正在导致错误消息。在文本和要写入日志的变量之间有逗号,因此它将$updateTag
视为error_log命令的第二个参数。
尝试:
error_log("max updateTag: " . $updateTag, 0);
摆脱你的警告和日志
是的,谢谢!但在此之后,什么也没有显示!我必须解决它! – malinchhan 2013-05-03 06:27:18
你的意思是你在日志中看到'max updateTag:',或者根本没有?如果什么都没有,那么检查这个代码嵌套的条件是否评估为真。 – PassKit 2013-05-03 06:32:30
是的,我可以看到,但是当我使用此更新标签选择其他查询时,我无法获得结果! – malinchhan 2013-05-03 06:35:10
看看$ row1 ['updateTag'],因为它可能无法被PHP格式化为数字。
echo $row1['updateTag'];
echo floatval($row1['updateTag']);
确认updateTag是一个数字。
但updateTag是时间戳! – malinchhan 2013-05-03 06:13:21
error_log("max updateTag:",1,$updateTag); // second var is type 0-3
Optional. Specifies the error log type.
Possible log types:
0 - Default. The error is sent to the servers logging system or a file, depending on how the error_log configuration is set in the php.ini file
1 - The error is sent by email to the address in the destination parameter. This message type is the only one that uses the headers parameter
2 - The error is sent through the PHP debugging connection. This option is only available in PHP 3
3 - The error is added to the file destination string
'$ updateTag'不包含文件名,因此不是有效的目标参数。其目的似乎是将可变内容回显到日志中,并且您的代码会将“max updateTag:”写入具有$ updateTag变量内容名称的文件名。 – PassKit 2013-05-03 06:28:16
哪条线是42写
$updateTag
内容? – zerkms 2013-05-03 05:55:55你有没有试过回显'$ updateTag'?它给了什么。 – 2013-05-03 05:58:10
我只是编辑我的问题,你可以看看! – malinchhan 2013-05-03 06:15:20