PHP

phpMyAdmin "Save as file" file name template

Submitted by charles on
When using phpMyadmin to backup a MySQL database, there is an option near the bottom to save as a file. When you use this option, you can make your life easier by using a file name template that automatically names the backup file for you. By default it is the database name, but I find it useful to put a timestamp on it as well. To do that, use the following in the file name template field: %Y%m%d%H%M%S-__DB__ This will save your files in the following format: 20070815152612-databasename.sql

Drupal node insert error related to the sequences table

Submitted by charles on

I recently added a lot of data to a drupal site by running some scripts that I'd created in php. This was to save me the time of manually capturing the content. After successfully adding the content, when I tried to add a new content item, I got the following error: Warning: Duplicate entry '503-503' for key 1 query: INSERT INTO node (nid, vid, title, type, uid, status, created, changed, comment, promote, moderate, sticky) VALUES (503, 503, 'World Bank ', 'content_organisation', 1, 1, 1171017191, 1171017191, 2, 1, 0, 0) in It turns out that Drupal uses the sequences table to keep track of what the highest id in certain tables is. I had forgotten to update this table with the id of the most recent node that I'd added.

Checking for PHP module dependencies

Submitted by charles on
I'm putting together an OpenLDAP authorisation system for a client's business web application, and wanted to test things out on my local windows machine. Well, I managed to get OpenLDAP working fine, but the authorisation using Apache has not been easy (in fact I'm still struggling with it ...). In the process, I've uninstalled and reinstalled php and apache a number of times to try and see where the problem is. This has in itself caused it's own issues, one of which was a php module not being loaded by apache.