Absolutely Tech

Installing a web server package for PHP development

So, you thought you would make a web application but didn’t know where to start?
This is the place to start. You need a web server installed on your computer before you start any kind of web programming be it PHP, ASP .Net, ColdFusion, JSP.

For developing in PHP, you would have to install an Apache HTTP server, php interpreter, MySQL server. Installing all of them would be a real headache and so would be configuring them to work with each other. To simply this we have WAMPs(Windows Apache, MySQL, PHP).

One such WAMP distribution is XAMPP which is cross platform and has many features inbuilt like filezilla ftp server, a mercury mailing server etc.

To install XAMPP first download the installer file for your OS from the following link:
http://www.apachefriends.org/en/xampp.html

Read the rest of this entry »

Get Auto Increment value from MySQL table

Many a times we require the next Auto Increment value from a MySQL table. Most of the people would do something like this:

$query = "Select MAX(id) from users";
$res = mysql_query($query);
$row = mysql_fetch_assoc($res);
$maxid = $row['MAX(id)'];
echo $maxid;

This would give correct results but if we delete the latest row, it will start to give wrong results.

We’ve got another query which can be used to get correct ‘Auto Increment’ values from the table.
Read the rest of this entry »

Debugging Javascript In Internet Explorer

Internet explorer has always been a programmer’s nightmare. You have finished a wonderful looking site, full of javascript effects just to find out that it doesn’t work in Internet Explorer. Its a real pain in the neck to find out which part of the script is causing errors in Internet Explorer.

In Firefox, we have tons of debugging option including the default error-console, firebug, etc which are very good tools. But in IE, the default error reporting mechanism shows wrong line no. most of the time, so its pretty useless.
Read the rest of this entry »

Solution to “MySQL Server Has Gone Away” Problem

Seriously guys, I got this error and I was laughing hard. The error is just too funny, don’t you think? Yes, it is but not for developers like me. Problem to this error is almost undetectable and there are more than a dozen reasons as to why this occurs and this often baffles developers.

This error generally comes when :

MySQL connection times out.

The MySQL server shuts down.

The connection is interrupted.

The query you are performing is too large for server to handle.

The query you are performing takes more space than allowed (default: 16MB).

While these are some common reasons, there maybe some unknown reasons to come across this error. I faced one of those unknown reasons. Read the rest of this entry »

[HowTo] Convert HTML to PDF using PHP

In a recent project, I had to output to a PDF file as well as to the browser. For this purpose first I downloaded the library from here. Then this code:

Read the rest of this entry »