Mysql: How to dump only the table data

How to download the table data by removing the create table format?

You can easily integrate your mysqldump command with -t parameter to exclude the create table part from your mysql dumping. The -t parameter will remove the drop table, and create table portion from your dumped data. And it will only consist the raw data as insert into format.


USERNAME = your mysql username;
PASSWORD = your mysql password;
DATABASE_NAME = your database name;
TABLE_NAME = the table you want to dump only the data.

From the above mysql dump command, the -t parameter is used to exclude the create table part from the dumped data. When you’ll open your .sql file after dump, you’ll find that it has the rows from your table.

The -t parameter is used when you have two same tables at your two different machines, and you want to migrate only the data. So the drop/create table won’t require by you. That’s why the -t to remove those part, and you can easily load the dumped file into your mysql table safely.


mysqldump -uroot test test1 -t > table.sql


/*!40000 ALTER TABLE `test1` DISABLE KEYS */;
INSERT INTO `test1` VALUES (‘name\’s’,’desc\’s’),(‘test’,’test;test;asdasd;akdajh;test’);
/*!40000 ALTER TABLE `test1` ENABLE KEYS */;


Hidden Link Display

In a paragraph showing the hidden links () by hovering the paragraph can done using the following CSS example,

CSS control for the paragrah and a tags,


p { margin-top:10px; color:#888888; text-align:justify; }
a { color:#718374; text-decoration:underline; }
.colorhover:hover a { color:#718374; text-decoration:underline; }
.colorhover:hover a:hover { color:#EEEEEE; }


<h2>Colorized links on hover paragraph</h2>
<p class=”colorhover”>Aenean non sem vel velit posuere laoreet. <a href=”” title=”Follow me on Twitter”>In hac habitasse</a> platea dictumst. Suspendisse posuere volutpat leo. <a href=”” title=”Subscribe to the feed”>Donec dictum</a>, ligula</p>

Customize webroot folder

In CakePHP  managing more than web site in the one webroot is can done by rewritng the URL in the .htaccess file located in the Webroot folder of CakePHP.

For example, i have the website application  say ‘forum’ folder and its located in my cakephp webroot folder on the existing site. By doing this update the .htaccess file.

RewriteRule    ^forum – [L]

Javascript Cheat Sheet

Here are the some of  cheat may helpful on list of Keywords available in javascript and also the cheat sheet.

Javascript Booklet

Javascript Cheat Sheet

HTML & CSS Cheat Seet

HTML and CSS Cheat Sheet  on the html entities and Character and other main CSS defination can find here,


Html Character Entities Cheat Sheet

Html Cheat Sheet

CSS Cheat Sheet

CSS 3 Tips

While applying CSS to the web page, these 3 steps will might be useful,


1. On any given div, if you specify a width, do NOT specify padding or margins (and vice versa). Specify padding and margins on the elements contained in that div instead. Ex: leftcolumn {width:200px} lefcolumn p {padding:10px;width:20px;}

2. Use Firebug and Web Developer Toolbar together. In Firebug, use the inspect button to see element names, styles, and inheritances. Then use Wed Developer’s CSS > Edit CSS panel to change the properties in real time. If anyone wants I can probably make a video screencast and show you some examples of what I mean.

3. Don’t obsess about validation or having perfect code. I know some coding Nazis might hang me for this one, but if you need to stick a clearing div here or use a IE6 hack for a specific issue there, do it. I used to have CSS OCD once too, it’s ok. But if I can save myself an hour of tearing my hair out trying to fix one small issue just in the name of perfect semantic markup – it’s not worth it (especially if your users will never notice or know about it). Life is short. Don’t spend it obsessing about CSS.

Password Reconfirmation

Secure password validation is very important when creating a user system. Imagine if users could have insecure passwords without a character limit. Many user’s would have extremely insecure password and this is why we need password validation.


The code bellow is quite easy to follow. Make sure you read the comments if you get lost.

function validate_pwd(){
    password = document.getElementById(“pass_new”).value;
    confirmPassword = document.getElementById(“repass_new”).value;
    errors.innerHTML = “<ul>”;
   var error = 0
    if (password.length < ‘8’ ) {
        errors.innerHTML = errors.innerHTML + “<li> Passwords must be at least 8 characters long”;
        error = 1;
    if(!(password == confirmPassword)){
        errors.innerHTML = errors.innerHTML + “<li> Passwords is not match</li>”;
 error = 1;
    if (!password.match(/[a-z]/)) {
        errors.innerHTML = errors.innerHTML + “<li> Passwords must contain one lowercase letter</li>”;
        error = 1;
    if (password.match(/[A-Z]/)) {
        errors.innerHTML = errors.innerHTML + “<li> Passwords must not contain one uppercase letter</li>”;
        error = 1;
    if (!password.match(/[1-9]/)) {
        errors.innerHTML = errors.innerHTML + “<li> Passwords must contain one number </li>”;
 error = 1;
    // If error is equal to one there must be an error
    if(error == 1){
        // Finish of the list for proper html
        errors.innerHTML = errors.innerHTML + “</ul>”;
        // Do not allow submit the form as we have had an error
 return false;
    // IF error is not equal to 1 then there was no errors
     } else {
  errors.innerHTML =”;
 // Allow the submit to take place
 return true;
<div id=”errors”> </div>

To get this validation to work all you need to do is add onSubmit="return validate()" into your form tag. Add this code to where you want your errors to be displayed

CSS : Page Break

For printing the 10 to 1000 web page content at a time with page break   with the some limited content per page can done using the breakhere CSS control all any HTML tag.

The format is,

P.breakhere {page-break-before: always}

Here i am using page break  in  <P class=”breakhere”> tag the content are get page breaked to take print out. When viewing the page content using Print Preview will see the effects of this CSS.

Top 10 PHP Mistakes

1. Single quotes, double quotes

It’s easy to just use double quotes when concatenating strings because it parses everything neatly without having to deal with escaping characters and using dot values. However, using single quotes has considerable performance gains, as it requires less processing.

Consider this string:
# $howdy = ‘everyone’;
# $foo = ‘hello $howdy’;
# $bar = “hello $howdy”;

$foo outputs to “hello $howdy” and $bar gives us “hello everyone”. That’s one less step that PHP has to process. It’s a small change that can make significant gains in the performance of the code.

2. Semicolon after a While

It’s funny how one little character can create havoc in a program, without even being reported to the PHP error logs! Such as it is with semicolons and While statements.

Codeutopia has an excellent example of this little error, showing that these nasty errors don’t even get reported (even to E_ALL!), as it quietly falls into a silent loop.

$i = 0;
while($i < 20); {
  //some code here

Omit the ; after the while statement, and your code is in the clear.

3. NOT Using database caching

If you’re using a database in your PHP application, it is strongly advised that you at least use some sort of database caching. Memcached has emerged as the most poplar caching system, with mammoth sites like Facebook endorsing the software.

Memcached is free and can provide very significant gains to your software. If your PHP is going into production, it’s strongly advised to use the caching system.

4. Missing Semicolon After a Break or a Continue

Like #2, a misused semicolon can create serious problems while silently slipping off into the shadows, making it quite difficult to track the error down.

If you’re using a semicolon after a “break” or “continue” in your code, it will convince the code to output a “0” and exit. This could cause some serious head scratching. You can avoid this by using braces with PHP control structures (via CodeUtopia).

5. Not Using E_ALL Reporting

Error reporting is a very handy feature in PHP, and if you’re not already using it, you should really turn it on. Error reporting takes much of the guesswork out of debugging code, and speeds up your overall development time.

While many PHP programmers may use error reporting, many aren’t utilizing the full extent of error reporting. E_ALL is a very strict type of error reporting, and using it ensures that even the smallest error is reported. (That’s a good thing if you’re wanting to write great code.)

When you’re done developing your program, be sure to turn off your reporting, as your users probably won’t want to see a bunch of error messages on pages that otherwise appear fine. (Even with the E_ALL error reporting on they hopefully won’t see any errors anyway, but mistakes do happen.)

6. Not Setting Time Limits On PHP Scripts

When PHP scripts run, it’s assumed that they’ll eventually finish in a timely manner. But every good programmer knows that nothing should be assumed in a piece of code. Nothing makes a program crankier than an unresponsive script.

You can get around this issue by simply setting a time limit on the script (set_time_limit). While it may seem like a trivial thing, it’s always clever to prepare for the worst.

7. Not Protecting Session ID’s

A very common PHP security mistake is not protecting session ID’s with at least some sort of encryption. Not protecting these Session ID’s is almost as bad as giving away a user’s passwords. A hacker could swoop in and steal a session ID, potentially giving him sensitive information. MT Soft an example of how to protect Session ID’s with sha1:

if ($_SESSION[‘sha1password’] == sha1($userpass)) {   // do sensitive things here


Adding the shai1 to the ($userpass) gives an added bit of security to the session. Sha1 isn’t a bulletproof method, but it’s a nice barrier of security to keep malicious users at bay.

8. Not Validating Cookie Data

How much trust do you put into cookies? Most people don’t think twice about the seemingly-harmless bit of data that’s passed by a cookie. The name “cookie” itself is associated Milk, nap time and Santa, for crying out loud! How could a cookie possibly harmless?

If you’re not validating cookie data, you’re opening your code to potential harmful data. You should use htmlspecialchars() or mysql_real_escape_string() to validate the cookie before storing it in a database.

9. Not Escaping Entities

Many times PHP programmers are too trusting with data, especially data generated by user. It’s imperative to sanitize data before it goes into any sort of storage, like a database.

Source Rally shows us how to correctly escape entities in things like forms. Instead of using this:

echo $_GET[‘username’];

You can validate the data by using htmlspecialchars() (or htmlentities()) like so:

echo htmlspecialchars($_GET[‘username’], ENT_QUOTES);

10. Using Wrong Comparison Operators

While comparison operators are an extremely basic part PHP programming, mixing these up in your code is certain to bork your program. As the German proverb states, the Devil is in the details.

Being familiar with the often-misused operators like =, ==, != , are absolutely critical to PHP programming. Taking the time to really understand the differences will greatly speed up your programming and yield less bugs to debug.

Chunk Split

Chunk Split is the good example for handling string for advanced customization. The below example will show you the customizing the string by spliting the paragraph by 20 lines each and the next example inserting the dot(.) in each character of the string,

Example 1:

$bild = “Angus Lewis Macdonald (1890–1954) was a Nova Scotian lawyer, law professor and politician. He served as the Liberal premier of Nova Scotia from 1933 to 1940 when he became the federal minister of defence for naval services. He oversaw the creation of an effective Canadian navy and Allied convoy service during World War II. After the war, he returned to Nova Scotia to become premier again. In the election of 1945, his Liberals swept back into power while their main rivals, the Conservatives, failed to win a single seat. The Liberal rallying cry, All’s Well With Angus L. seemed so convincing that the Conservatives despaired of ever beating Macdonald. He died suddenly in office in 1954. Macdonald’s more than 15 years as premier brought fundamental changes. Under his leadership, the Nova Scotian government spent more than $100 million paving roads, building bridges, extending electrical systems and improving public education. Macdonald dealt with the mass unemployment of the Great Depression by putting the jobless to work on highway projects. Macdonald was one of the most eloquent political orators in Nova Scotian history.”;

$emailbody = chunk_split($bild,50,'<br/>’);
echo $emailbody;

Example 2:   

$str = “Hello world!”;
echo chunk_split($str,1,”.”);


                     H.e.l.l.o. w.o.r.l.d

« Older entries