WebDev

PHP – Using ARRAY_MAP to generate an ON DUPLICATE KEY UPDATE statement

This bit of code is very cool;
function getUpdateString($arrayKey, $arrayValue)
{
 return($arrayKey . ‘=’ . $arrayValue);
}
   $values['key1'] = ‘value1′;
   $values['key2'] = ‘value2′;
   $sql = ‘INSERT INTO table ( ‘ . implode(‘, ‘,array_keys($values)) . ‘ )
      VALUES ( ‘ . implode(‘, ‘,array_values($values)) . ‘ )
      ON DUPLICATE KEY UPDATE ‘ . implode(‘, ‘,array_map(‘getUpdateString’,array_keys($values),array_values($values)));
Returns a SQL statement:
INSERT INTO table ( key1, key2 ) VALUES ( [...]


INSERT INTO from SELECT

SELECT <field>[, ...]
INTO <table>
FROM <table>
WHERE <criteria>
or
INSERT INTO <table> ( <field>[, ...] )
SELECT <field>[, ...]
FROM <table>
WHERE <criteria>
example
INSERT INTO auth_users ( user_id, auth_id, auth_setting )
SELECT user_id, 1301 AS auth_id, ‘Y’ AS auth_setting
FROM evedr_users
WHERE user_id > 1


PostLevels2 v0.10.1 Bug Fix Release

Visit the Change Log (NOTE: You must register for a user account on the bugtracker, and you may wish to filter for only Post Levels related changes).
I’d like to thank Katy and Sine for pointing out bugs that were addressed in this release.  If you have any feature quests, please make them on the bug tracker [...]


Post Levels 2 v0.10.0

I’ve completed the first draft of the Post Levels 2 plugin that I’m using here.
Post Levels is a Wordpress plugin that permits the administrator to hide private posts from users with insufficient access.  This is performed by assigning a post level to each post, and a user level to each user, and a post is [...]


Post Levels / Welcome to DISQUS

A while back I signed up for a DISQUS account to comment on Fortes’ discussion thread about his Post Levels plugin.  Now that I’ve spent a couple of days beating my head against a wall to understand what it was that he did and try to work out comments for the code that hopefully even [...]


RSS Tricks with Wordpress

Found an excellent post at Smashing Magazine about setting up Catagory specific feeds, I especially like two points in the post.  For those who are interested primarily in reading only the stuff on my Blog that is Nortel related for example, this technique is pretty cool.  I’ll have to incorporate this in to my theme.
8. [...]


Project Diary: Xtools (9)

I’ve not made any updates lately because I’ve been learning AJAX coding techniques and I’ve been working instead on the hotfix parser.  AJAX has a lot debate on what exactly it is (which is weird), but the definition used in the book that I’m reading (and on Wikipedia) is that it is essentially a client-side [...]


Project Diary: Xtools (8)

Brought the 0.10.2 revision over to the production site as it fixes a number of critical bugs.  I’m still working on 0.11.0, which begins the implementation of the ESN parser.  All database tables have been generated and the upgrade code has been written in to the core plugin code so that when it’s moved over [...]


Project Diary: Xtools (7)

Revised all Xtools templates to continue to output the content of the page from WordPress (for notes/comments/documentation links/etc).
Documented known bugs in a publically accessible format (in preparation for adding more beta testers)

DNB Parsing, Best Practices
DNB Types [static list]

Documented best practices in a publically accessible format (same as above)
Continued work on ESN parser & templates


Old Verio Hosting

I just discovered this week that despite the fact that I discontinued my hosting through Verio, they continued to host my content via the IP address assigned to my old website. In fact, my old username/password still gave me access to the FTP account.
I had thought that they would wipe all of the content [...]