PHP

Today we will learn a few interesting things about SQL Query Optimization.
How to get query execution time and executed query number?
Follow the code given below:
function timer()
{
$time = explode(‘ ‘, microtime());
return $time[0]+$time[1];
}
$beginning = timer();
$timer_queries += round(timer()-$beginning,6);

The sql query becomes faster if you use the actual columns names in SELECT statement instead of than ‘*’.
For Example: Write [...]

  • Share/Bookmark
Tags:

Now a days Ajax is a most popular technology in web-development field.
Here we will see how can we select country and city dynamically without refreshing a page using ajax.
First create two tables and insert some data into the database.
one table for country and another for city.
The tables structure are given below-
tb_country

country_id
country_name

1
India

2
Pakistan

3
USA

here country_id is defined [...]

  • Share/Bookmark
Tags: ,

Currently I am working in PHP thumbnail generator, which basically creates thumbnail image of original image and store it in a particular folder. This functionality is very useful because some time we need to show thumbnail image to the user. Every time when we upload image we don’t want to try the actual height, width [...]

  • Share/Bookmark
Tags:

Folder structure [From root]

Application
 

Controllers

This is the controller section of your site .
Controllers are nothing but a class file & within the class many action controller function/method are defined.

Controller function name is very case sensitive (camelCase) . [...]

  • Share/Bookmark
Tags:

Variable declaration / definition
To access a variable you have to declare it from your controller section & then you can use this variable in the view section.
Usage: Controller page
public function nameAction()
{
$request = $this->getRequest();
$this->view->assign(‘name’, ‘Sandipan Bhattacharjee’); // we assign a value to the name variable
[...]

  • Share/Bookmark
Tags:

Database Manipulation

Create a controller
Call / Create(Write) Database configuration setting
Request data object creation
Assign message (Success / Failure / Already exists)
Create a view page to see the message or to redirect to the previous page to fill it up again

Controller creation
public function processAction(){
}
Database configuration creation/call from registry
$registry = Zend_Registry::getInstance();
$DB = $registry['DB'];
Or
$params = array(‘host’=>’localhost’ , ‘username’ [...]

  • Share/Bookmark
Tags:

Hi 2yall! As I promised in summer to be back, I am again here in Kolkata and at Codez in winter to feel the hot in this cold. It’s relishing to be a part of Codez team again.  This time I am here for just a month but I believe my project to be equally [...]

  • Share/Bookmark
Tags:

If you are looking for a PHP short code to connect to your MySql database, please check out the following code for PHP/MySql database connectivity. This is simplest way to connect to a MySql database using PHP.
<?php
$link = mysql_connect(‘host-address’, ‘mysql_user’, ‘mysql_password’);
if (!$link) {
die(‘Not connected : ‘ . mysql_error());
}
// assume “database-name” as [...]

  • Share/Bookmark
Tags:

Last week while I was working on an auction management project, I faced a time zone problem. The problem was that my web server was in USA and I have to manage online auction in India. So when I gave an auction its Start Date and End Date, it stored Indian time in the database, [...]

  • Share/Bookmark

###1:
This week I will show you how to generate dynamic <li> under <ul> contains country and when the < li> will selected a dynamic class generate:
<?php
ini_set(‘display_errors’,1);
[...]

  • Share/Bookmark
Tags: