Thursday, March 25, 2010

MagpieRSS question marks

If you are trying to use MagpieRSS, you might encounter an issue where quotation marks (single and double quotation marks), and other characters, are simply displayed as questions marks (?) in the RSS output.

The issue is an charset issue. 1) You need to tell Magpie to output in utf-8. 2) Additionally, your HTML page needs to be in the same charset.

For 1)

Before any of your MagpieRSS code ... include these PHP statements.

define('MAGPIE_INPUT_ENCODING', 'UTF-8');

define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');


For 2)

Make sure your page has this at the top ... you might need to replace whatever is already defined on the page.

EDIT: Blogger doesn't like META tags ... here is what you need at the top of your page: http://pastebin.ca/1852343


Thanks to http://forums.digitalpoint.com/showthread.php?t=309378 for the tips.

Saturday, March 6, 2010

Concatenate Date and Time From Two Fields -- MySQL

Example
In this example, I'm checking whether a time slot in a schedule table is in the future.

SELECT * FROM table
WHERE concat(date(appt_date)," ",time(start_time)) > NOW( )
ORDER by appt_date desc, start_time desc, end_time desc