[PHP-DB] Re: newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?

2009-08-03 Thread Nisse Engström
On Mon, 3 Aug 2009 11:52:11 +0200, Nisse Engström wrote:

 You could use the date as an index:
 
   ... SELECT DATE(`datetimecolumn`) AS `date` ...
 
   while ($TrackingRow = mysql_fetch_object (...)) {
 $data[$TrackingRow['date']] = $TrackingRow;
 /* Store the last row from each set of dates */
   }
 
 or
 
   while ($TrackingRow = mysql_fetch_object (...)) {
 if (!isset ($data[$TrackingRow['date']])) {
   $data[$TrackingRow['date']] = $TrackingRow;
 }
 /* Store the first row from each set of dates */
   }

And, of course, if you want all rows to be indexed by date:

  while ($TrackingRow = mysql_fetch_object (...)) {
$data[$TrackingRow['date']][] = $TrackingRow;
  }


/Nisse

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Unicode error with PostgreSQL

2006-10-03 Thread Nisse Engström
On Tue, 26 Sep 2006 12:05:56 -0600, Tony Grimes wrote:

 I'm getting the following error when PHP tries to insert a Unicode character
 (the problem word is resume with the accents) into a PostgreSQL database:
 
 pg_exec(): Query failed: ERROR:  Invalid UNICODE character sequence found
 (0xe97375)
 
 I can't figure out why I'm getting the error. The HTML form is utf-8 and the
 database is UNICODE, but I'm still getting the error. Is there some problem
 with the PHP library? Is there a PHP setting that controls character
 encoding within scripts? Any help would be appreciated.

   0xe97375 is ésu[1] in a lot of code pages such
as ISO-8859-1, and Windows cp1252. It is NOT a valid
UTF-8 sequence. I would guess that the form is sent
using one of those code pages and not UTF-8.


  --nfe

[1]: e-acute, s, u

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php