2

I create digiCardPass with updateTag column that is timestamp. I try:

   $query1 = mysql_query("select MAX(updateTag) as updateTag from digiCardPass");
   $row1 = mysql_fetch_array($query1);
   $updateTag = $row1['updateTag'];
   error_log("max updateTag:",$updateTag,0);

But I cannot get this error in php_error.log:

[03-May-2013 12:46:06 Asia/Phnom_Penh] PHP Notice: A non well formed numeric value encountered in /Applications/MAMP/htdocs/passesWebserver/createPass/index.php on line 42 [03-May-2013 12:46:06 Asia/Phnom_Penh] max updateTag:

   //line 42: error_log("max updateTag:",$updateTag,0);

How to solve this problem ?

malinchhan
  • 767
  • 2
  • 8
  • 28

3 Answers3

2

Your error_log statement is incorrect and is causing the error message. You have a comma between your text and the variable that you want to write to the log, so it is treating the $updateTag as the second parameter of the error_log command.

Try:

error_log("max updateTag: " . $updateTag, 0);

to get rid of your warning and write the contents of $updateTag in the log

PassKit
  • 12,231
  • 5
  • 57
  • 75
  • yes, thank you ! but after that , nothing shows ! I got to fix it up ! – malinchhan May 03 '13 at 06:27
  • 1
    You mean you see `max updateTag:` in the log, or nothing at all? If nothing at all then check to see if whatever condition this code is nested in is evaluating true. – PassKit May 03 '13 at 06:32
  • yes, I can see, but when I select in other query by using this updateTag, I cannot get result ! – malinchhan May 03 '13 at 06:35
  • How are you using it your other query? – PassKit May 03 '13 at 06:36
  • I use it with where condition. This is the query: select passTypeID, authenticationToken as auth, auxiliaryFieldsPowerBy as aux, associatedStoreIdentifiers as asso, altTextBarcode as alt from digiCardPass where updateTag = '$updateTag' – malinchhan May 03 '13 at 06:38
  • I try to test this query in SQL already and It works, but not work in here ! – malinchhan May 03 '13 at 06:39
1

Take a look at $row1['updateTag'] as it probably can't be formatted as a number by PHP.

echo $row1['updateTag'];
echo floatval($row1['updateTag']);

Get sure updateTag is a number.

medina
  • 8,051
  • 4
  • 25
  • 24
-1
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
JOE LEE
  • 1,058
  • 1
  • 6
  • 6
  • `$updateTag` does not contain a filename and so is not a valid destination parameter. The intention appears to be to echo the variable content to the log and your code will write "max updateTag:" to a filename with the name of the contents of the $updateTag variable. – PassKit May 03 '13 at 06:28