Need someone with a fresh mind on tacking this array problem...

From: Date: Wed, 18 Jun 2003 17:32:19 +0000
Subject: Need someone with a fresh mind on tacking this array problem...
Groups: php.general 
Request: Send a blank email to php-general+get-152028@lists.php.net to get a copy of this message
Hi, need someone with a fresh mind on tacking this problem. I haven't gotten this to work right for 1 1/2 days now. In the sample script, you will noticed that the php variable, '$ODBC_RESULT' represent a year in 4 digit, like 2003, 2002, 2001, 2000, etc... When I grab the data from the database and put it into a loop, the only thing I need to do is to have PHP spit out the javascript code if the year is a first time use and have PHP not to spit out the javascript code if the same year is being repeated... Just like that. I don't know what I am doing wrong. I did declare the $ArrayDataCount before the start of the loop. This sample code is inside the loop. --clip-- $ODBC_RESULT = trim(odbc_result($result,2)); $ArrayCheck = $ArrayDataCount['$ODBC_RESULT']; $ArrayCheck += 0; if (strlen(trim($ArrayCheck)) == 0) { $ArrayCheck = 0; } else { $ArrayCheck = $ArrayDataCount['$ODBC_RESULT']; } if ($ArrayCheck == 0) { $ArrayDataCount['$ODBC_RESULT'] = "0"; } else { $ArrayCheck++; $ArrayDataCount['$ODBC_RESULT'] = $ArrayCheck; } if ($ArrayCheck == 0) { echo " jsTimeRange['".trim(odbc_result($result,2))."'] = new Array(new Array(),new Array());\n"; } --clip-- Thanks! Scott

« previous php.general (#152028) next »