Fix SQL INSERT problems with PHP addslashes function

If you’ve created you own custom content management system using PHP, you may have noticed problems inserting data. One of the problems could be that your data may have characters that prevent it from being inserted. Some of the character that would cause this type of problem are single or double quotes, backslash, and NUL characters.

You can escape these problematic characters using the PHP function addslashes(). As explained by the PHP manual: It returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote (), double quote (), backslash (\) and NUL (the NULL byte).

As you can see from my example below, I first run the content through the addshashes function and than return it to the same named string “$Page_Content” before passing it to my SQL UPDATE or INSERT statement.

$Page_Content = addslashes($Page_Content);
$query = "UPDATE site_content SET Page_Title='$Page_Title', Page_Content='$Page_Content' WHERE id_f='$id_f'";
Tagged : / / /

iPod stuck on eject before disconnecting screen

My wife’s iPod mini got stuck on the “connected, eject before disconnecting” screen. She was so upset because this was a replacement for the first bad iPod mini. This time it wasn’t the mini, it was a human error.

To reset the iPod mini, or any iPod for that with the wheel, toggle the top hold switch on and off then press and hold the middle select button and the “menu” button togather for a few seconds (until it resets to the apple logo).
The problem, I’m sure, was failed to disconnect the iPod before ejecting it from the iTunes device list.

Tagged : / / / / /