Posts

Showing posts from March, 2013

Profiling PHP Connections - Pool vs No Pool

Creating connection in efficient way is important, specifically if you are writing a consumber website that targets thousands of concurrent visitors. In this post I would share some performance statistics of creating connections using connection pool and without using connection pool. To see the performance difference, I created 100 connections without using connection pool and another 100 connections using connection pool. Here I show you the average time of creating one connection.  I repeated same process 10 times, here are the states: Time to get one connection at localhost, in milliseconds. Without Connection Pool   |   With Connection Pool                                   9.37    |    0.99       ms                                 11.06    |    1.02       ms                                 10.48    |    0.77       ms                                 10.82    |    0.81       ms                                 10.13    |    0.81       ms                                 11.49    |  

Best Web Based Mockups Creation Tool

In last few days I spent couple of hours searching and trying different mockups creations tools/solutions. Some were only desktop based, otherwise were web based by paid. I was searching for great mockup tool that must be web based and free. Why web based, I wanted to share my created mockups with my team members. Here is the tool I finally have decided to pick. Hope you would like it too.  https://moqups.com

PHP Update Form

Image
In PHP Update Form post, I would explain how you can display an HTML form that is already filled or populated. We often need it to update some previous data. Lets first see the code, then we would move to some points that you must understand about creating update form in php: PHP Update Form // Lets assume following are the earlier values that we want to update $name='Asif'; $password = 'mypassword'; $credit_card = 'Visa'; $city = 'Lahore'; $subjects = array("Algorithms", "OOP"); $languages = array("Java", "PHP"); // To populate these values in form, we must set these some attribute of form input controls, see below ?> Update Student Info. Name Password Subjects /> Algorithms />OOP /> Data Structures Credit Card />Visa />Master Card />American Express Ci

PHP Full Form

Image
In this post I would explain how to process a form using PHP. Before we move to PHP code, lets see how our HTML code looks like which creates the form. I have included all possible basic controls (text, checkbox, radio, option list, etc) to demonstrate how fetching values for different type of controls differ when we write PHP code. Form with all controls Student Registration Form Name Password Subjects Algorithms OOP Data Structures Credit Card Visa Master Card American Express City Lahore Karachi Islamabad Favorite Languages Java PHP Ruby C C# If you know HTML, you know there is nothing special in above file. Its just plain HTML. Notice, action value is full-form-handler.php. It means, when the user submit this form, full-form-handler.php would be executed to

PHP Form

Image
In this post I would create a simple form in HTML (with just two input boxes) and then write PHP code to retrieve the form values a user submit using PHP. So in our sample project there are only two files: form.html form-handler.php Let see the form.html code: PHP Form First Name: Last Name: This form will generate following output: There are following points to note: The action attribute value is form-handler.php . It shows, when the form is submitted form-handler.php would process the form. Processing includes, retrieving form data and storing it somewhere if you want to. The input text boxes names are first-name and last-name . On PHP page, we would use these  names to retrieve the values user entered in the PHP form. The Server Side The form-handler.php code retrieves the both input values and display on the next page. Lets first look at the form-handler.php code. $first_name = $_REQUEST['first-name']; $last_name = $_REQUEST['l