Archive for the 'Web development' Category

Page 2 of 2

How to start your own blog?

So you have decided to start your first blog? That’s great. You are in a right place. There are three ways you should consider if you want to create a new blog. It depends from two things – money you want to invest and tech knowledge that you have.

Continue reading…

Booking Calendar Lite released as free GPL script

I have decided to release some of my code as a free scripts under a GPL licence. My first choice is my “Booking Calendar Lite” written in PHP with MySQL support. Nice script that allow to publish on your website if some resource is free, reserved or occupied (or any other states you set in a config). You may find it under “CODE” section on my blog and see the script with a demo here “Booking Calendar Lite“. I hope you will enjoy my script as much as I did when I was writing it :).

How to make WordPress “Page” link to any url

Today I have been looking for solution for making one of my “page” links linking to category of posts for one of my WordPress projects. I have found a few tips about putting “href” tags in description etc. But it have broken my layout.

Then I have found great WordPress plugin called “Page Links To” that would let you put any URL instead of your real page content (even external!). When you install it you get additional field in your Add New Page section where you can put your url. For me it works like a charm!

Problem with 404 error on /wp-admin/ in WordPress

I have just been moving my blog to new host. Everything was fine after I did it as described at WordPress Codex except admin panel.

When I was trying to login to Dashboard I got 404 error. There is one very simple solution for it. When I was moving files from my old host my ftp client set chmod of /wp-admin/ directory to 775. It won’t work with this permission. All you need to do is to change it to 755 and it should be working again.

MySQL login details in WordPress

If you have decided to move a copy of your wordpress to other host propably you will have problem with your mysql login details. Even if mysql database name, login and password are same – propably you will have to change login host (until it is not localhost :) ). It is very easy to do. All you need to change after you copy WordPress script to your new account is to edit wp-config.php file. Open it in any text editor (Notepad would be ok), find and edit following lines:

define('DB_NAME', 'put_db_name_here');
define('DB_USER', 'put_db_login_here');
define('DB_PASSWORD', 'put_db_password_here');
define('DB_HOST', 'put_mysql_host_here');

And that’s all :)

WordPress K2 theme and problem with comments (solution)

Since I have upgraded a WordPress to version 2.8 I have seen new comments counted by Akismet plugin but nothing in spam queue nor any comments to approve. It looked very strange for me!

I have logged out from my blog admin and tried to post a comment. After submitting it I saw a blank page!

The worst thing was that I have not found any solutions in google (and people say that google always knows the answer :)) – so I decided to upgrade K2 Theme… But there is now new release on their main page!

But wait! There is a solution! (or I would not write this post :)) After some googling (ok… please forget what I wrote about google before… :D) I have found K2 nightly build subpage… All you need to do to fix this issue is to upgrade K2 with nightly build. It can be downloaded from:

I have decided to download last RC8 version ( And now you can test if comments are working again :)

Form element name change with JavaScript and radio button

Today I have had to modify very complex script to change look of html form. It is quite easy to make changes in the form. But sometimes it is a problem to modify not to well written PHP script to receive data from new form.
Continue reading…

Sort VARCHAR as INT in MySQL query

If you need to sort varchar data as int, there is one very nice function in MySQL. Problem I had to solve was to sort values as below in a human logical way. Values were similar to this (and I wanted it to be sorted like below):

1; 2; 2a; 3; 4; 5; 5a; 5b; 5c; 6; 7; 11; 14; 14a; 16;

The problem was that if I put this data to MySQL database as varchar and sort by this column, MySQL returned it this way:

1; 11; 14; 14a; 16; 2; 2a; 3; 4; 5; 5a; 5b; 5c; 6; 7;
Continue reading…

How to enable error reporting in PHP script

If error reporting is disabled by default on your host you have two solutions.
First is to add to your PHP script this little piece of code:

  ini_set("display_errors", 1);
  // the rest of your script...

Additionally it is very useful to enable E_STRICT reporting level as well (not included in E_ALL). E_STRICT run-time notices, enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code. To turn it on your code should look like this:

  error_reporting(E_ALL | E_STRICT);
  ini_set("display_errors", 1);
  // the rest of your script...

But putting this code on the top of your script will not catch any parse errors. A missing “)” or “;” will still lead to a blank page. This is because the entire script is parsed before any of it is executed. If you are unable to change php.ini (that would be the best solution) and set in it

display_errors On

then there is a possible workaround (found on comments on website). This code would solve this problem:

  error_reporting(E_ALL | E_STRICT);
  ini_set("display_errors", 1);

You may go even further and make a little debug script with error reporting (when it is disabled for the rest of your scripts). Just create a file called “debug.php” with this content:

  error_reporting(E_ALL | E_STRICT);
  ini_set("display_errors", 1);

Then you will be able to execute any script on your web host just by calling “debug.php” with urls like this

Second alternative soulution is to edit your .htaccess file. It would enable error reporting for all files in current directory. All you need to do is to simply add the following lines:

php_value display_errors 1
php_value display_startup_errors 1