me

Archive for the ‘Uncategorized’ Category

PHP and MySQL primer

Saturday, January 14th, 2012

Howdy! This is a PHP and MySQL primer. It assumes that you have installed Apache, PHP and MySQL.

PHP

PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages.

A simple hello world program in PHP:

echo "Hello World!";

Using PHP with MySQL

PHP is a great scripting language but for developing scalable projects you’ll need a database. In this case I am going to show you how to connect and use PHP with a MySQL database.

Connect to a database

mysql_connect("localhost", "username", "password") or die(mysql_error());
echo "Connection to MySQL successful!";

Selecting a database

Once we are connected to MySQL we need to connect with the database we are going to be working on.

mysql_select_db("databasename") or die(mysql_error());
echo "Connected to database!"

Executing SQL queries

Okay great! We have connected to MySQL and we are connected to our database! Now what? Well now you can execute SQL queries to interact with the database.

For execution of a SQL query on the active database PHP provides a function

 mysql_query();

The function accepts an SQL statement as its parameter

For example here is a code that executes SQL code for creating a table

mysql_query("
     CREATE TABLE test(
         id INT NOT NULL AUTO_INCREMENT,
         name VARCHAR(45),
         PRIMARY KEY(id)
        )");

Well so thats a wrap!

Happy Holi

Saturday, March 19th, 2011

Wishing everyone a very happy and prosperous holi! For those not playing outside this year, check out this (even those playing can check out ;)
Uses jQuery and RaphaelJS. More on that coming soon.

Open source facebook launching soon

Tuesday, August 31st, 2010

Diaspora is a sort of open source version of facebook. Yeah I am sure it sounds cool…I mean its gotta be cool…its OPEN SOURCE! Well nah! I am not that excited. Its time the open source community started encouraging more innovative and interesting ideas instead of building polished clones of same old ideas.

PS: I am open source enthusiast. I publish open source designs and codes :)

Content is King…even in Web Designing

Monday, November 9th, 2009

This is one of those random snippets about web designing. I recorded amidst watching a movie.

The secret behind a good web design is that it makes sure that the content occupies the driving seat.  Sure there are beautiful graphic effects, photoshop tricks, fancy stuff to lure you, but as a designer you have to make sure that the design is not so overwhelming that it outshines the content. For a great design you need to make sure that you incorporate subtle effects to intact enhance the prominence of the content.