یادگیری برنامه نویسی حرفه ای

یادگیری برنامه نویسی حرفه ای

دانلود آموزش های چندرسانه ای

MySQL: How to add column to existing table

mysql how to add columnMany ways to add column to existing table in MySQL. If you r using GUI tools, add column to table in MySQL is easy. If you are using CLI, then here’s the command to add column in MySQL table.

To add column in existing table, you may refer to the 2 examples below:-
Example I: Add new varchar column to the end of the table

ALTER TABLE `tablename_here` ADD `new_column_name` VARCHAR( 255 ) NOT NULL ;

Example II: Add new integer column after an existing column in table

ALTER TABLE `tablename_here` ADD `new_column_name` INT NOT NULL AFTER `existing_column` ;

It’s simple to add column to existing table right? :)

+ نوشته شده در  چهارشنبه سی ام دی 1388ساعت 16:50  توسط الف. حکم آبادی  | 

30+ Firefox Add-ons for Web Developers & Designers

Firefox (Firefox) has cool add-ons which make the job of website designers and developers much easier. Here is our list of 30+ excellent Firefox add-ons that every web developer and designer should know about.


Aardvark – A cool extension for web developers and designers, allows them to view CSS attributes, id, class by highlighting page element individually.

chromEdit – Alter the appearance of any page by editing CSS and Javascript files with this extension.

CSSMate – Firefox extension to edit CSS files.

CSS validator – Check the validity of your webpage using this CSS validator extension.

CSSViewer – See the CSS properties of page elements with this extension.

EditCSS – Play around with loaded CSS, Web Developer extension also provides this functionality.

IE Tab – Designers and developers can view their CSS projects on Internet Explorer (Internet Explorer) using this extension.

Style Sheet Chooser II – Users can pick and choose alternate style sheets for a website.

Debugging and Analysis


FireBug – A console for debugging JavaScript, HTML, and Ajax code snippets.

HTML ValidatorCool () extension to validate web pages with HTML standards of W3C.

JavaScript Debugger – JavaScript debugging extension enables a strong debugging environment.

Link Checker
– Check the links on a webpage for validity. Color to each link explains its current status.

Load Time Analyzer
– View detailed graphs of the loading time of web pages in firefox. The graphs display events like page requests, image loading times etc.

View Dependencies – Find out all files that were loaded in a webpage with the view dependencies tab in page info.



– Easily save portions of webpage with this extension.

– Excellent extension for web page designers, codetech is a web page editor with the look and feel of Dreamweaver.

– A nice extension for web designers and developers. Colorzilla helps users to select colors which can be adjusted and put in any other program.

FirePHP – Find out what PHP () code in the backend does to pages on display in Firefox browsers.

Flash Switcher
– Use this extension to avoid reloading between flash plugins.

Greasemonkey – Control any aspect of web page behavior by adding Javascript code to any webpage using this Firefox extension.

– Users can calculate the measurement specifications of tables, paragraphs on internet.

– One of the best Firefox extensions for modifying a webpage. Users can modify a webpage, save their changes as a Greasemonkey script and their saved page would be loaded the next time they visit the page.

– A must have tool for web developers enabling them to interact with web services and other web resources.

Professor X
– Check out the contents of the head of page without getting into source code.

Screen grab – Capture screenshot of any webpage and save it as an image file with this extension.

TestGen4Web – Save the webpage activities users (entry of text, web page clicks) in xml file. These actions can later on be replayed and converted to scripts for automated test tools.

View Source Chart – View the source code of any webpage as Firefox sees it.

Web Developer
– Add a menu of various web development tools with web developer extension.

– Must have Firefox extension, it allows users to view webpage code with a right-click and shuffle between the webpage and its code easily.

+ نوشته شده در  چهارشنبه سی ام دی 1388ساعت 7:13  توسط الف. حکم آبادی  | 

Convert MyISAM tables to InnoDB

If you want to convert a MyISAM table to InnoDB, the process is fairly easy, but you can do something extra to speed things up. Before converting the table, adjust its order so that the primary key column is in order:
ALTER TABLE tablename ORDER BY 'primary_key_column';

This will pre-arrange the table so that it can be converted quickly without a lot of re-arranging required in MySQL. Then, simply change the table engine:


If your table is large, then it may take a while to convert it over. There will probably be a fair amount of CPU usage and disk I/O in the process.

These statements are also safe in replicated environments. When you issue this statement to the master, it will begin the conversion process. Once it is complete on the master, the statement will roll down to the slaves, and they will begin the conversion as well. Keep in mind, however, that this can greatly reduce the performance of your configuration in the process.

convert from latin1_swedish_ci to UTF8

In short:


+ نوشته شده در  دوشنبه بیست و هشتم دی 1388ساعت 15:23  توسط الف. حکم آبادی  | 

Delete and Truncate

There are two ways to delete all the data in a MySQL database table.

TRUNCATE TABLE tablename; This will delete all data in the table very quickly. In MySQL the table is actually dropped and recreated, hence the speed of the query. The number of deleted rows for MyISAM tables returned is zero; for INNODB it returns the actual number deleted.

DELETE FROM tablename; This also deletes all the data in the table, but is not as quick as using the "TRUNCATE TABLE" method. In MySQL >= 4.0 the number of rows deleted is returned; in MySQL 3.23 the number returned is always zero.

Auto Increment Columns for MyISAM Tables

If you have an auto increment primary key column in your MyISAM table the result will be slightly different depending which delete method you use. When using the "TRUNCATE TABLE" method the auto increment seed value will be reset back to 1. When using the "DELETE FROM" method the auto increment seed will be left as it was before (eg if the auto increment field of last inserted record was 123 the next inserted record will be set to 124).

Note that this is true for MySQL >= 4.0; from my reading of the TRUNCATE manual page in MySQL 3.23 TRUNCATE works just like DELETE which would mean the auto increment seed is not reset. I do not currently have a 3.23 database set up to test it so cannot confirm this.

Auto Increment Columns for INNODB Tables

For INNODB tables, whether you use the "TRUNCATE TABLE" or "DELETE FROM" methods, the auto increment field will not be reset. If you inserted 5 records into a new table, then deleted all records and inserted another record, the field would have a value of 6, regardless of which method you used.

Update 17 Feb 2009: I originally wrote this post when MySQL 4.0 was the current version. I've just tested the above now on an INNODB table using MySQL 5.0 and using TRUNCATE does reset the auto increment field back to the default. So either the behaviour changed at some point or I was incorrect when making the above statement.

Are you really sure you want to delete all data?

Before deleting all the data in a database you should make sure you really intend to delete all the data. It often pays first to "SELECT * FROM tablename" or "SELECT COUNT(*) FROM tablename" before doing so to check that it really is safe to delete all data. Maybe you really want to do something like "DELETE FROM tablename WHERE foo = 'bar'" instead.


+ نوشته شده در  چهارشنبه بیست و سوم دی 1388ساعت 12:37  توسط الف. حکم آبادی  | 

اداره چند submit در یک form با PHP

The HTML Form Submit Button

The basics of an HTML form submit button is discussed first in this article, moving towards more advanced topics like multiple submit buttons.

Note: If you are looking for a software tool for creating HTML forms quickly ( without even knowing HTML), see the article: How to make a web form and get it online quickly. This article contains more information about Simfatic Forms - an easy to use form creation software.

In order to create an HTML form submit button, you can use the HTML code below:

name: specifies the identification assigned to this submit button.
value: is the label that appears on the button.

The code above will create the submit button as shown below:

Identifying the submit button on the server side

The name and value of the button that is used to submit the form is passed along with the other data to the server script. For the button above, when you click on the submit button, the data passed to the server side script is mysubmit=Click!

Having Multiple Submit buttons

You can have more than one submit button in a form. But, how to identify from the server side which button submitted the form?

One way is to have different names for the submit buttons.

In the server side script you can do a check like this:
  //Do update here..
  //Do insert Here

Note: The code depends on the server side scripting language you use. The code above is in PHP. The second method is to have different values for submit buttons with the same name.

and in the server side it could be handled like this:
if($Operation == "Update")
  //Do update here..
if($Operation == "Insert")
  //Do insert here

Switching the 'action' field dynamically

It is commonly required to switch the action field of the dynamically based on certain conditions.
Read: Switching HTML form 'action' field dynamically

How to submit a form on click of a hyperlink or an image?
Read: Tutorial on JavaScript Form Submit Methods

You can find more on HTML Forms in the HTML Form Tutorial

Using Simfatic forms, it is simple, quick & easy to create HTML forms. Click here for more info.

ادامه مطلب
+ نوشته شده در  سه شنبه هشتم دی 1388ساعت 11:39  توسط الف. حکم آبادی  |