How to change the sequence of columns of a table in mysql – phpmyadmin

This tutorial explains how you can change the sequence of the columns in a mysql database’s table (in phpmyadmin or by using php code) I wrote this article while doing this practically right now as i wasn’t able to find any proper information online about it, and among those that i found, NONE was working. […]

Convert string variable characters to ASCII codes using PHP

In situations where you want to convert the value stored in your variable to ascii code in PHP you can use the following code. function nabascii($input) { foreach (str_split($input) as $obj) { $output .= ‘&#’ . ord($obj) . ‘;’; } return $output; } Call the code by using: $myvariable = “nabeel”; echo nabascii($myvariable); This small […]

How to ping domain name url or ip address using PHP

This code will let you ping any ip-address or website url and get the response. <pre> <?php system(‘ping -c 1 google.com’); // Ping IP address. echo “pinged”; ?> </pre> The <pre> tag is used so that the code shown looks nice. 1 in the ping code indicates the number of times to ping the ipaddress […]

How to remove last (few) characters of a string variable in PHP

If you are in a situation where you need to remove last few (one or two, or even three or so on) characters from a variable using php, then the solution is pretty much simple. Simply use this function to remove any number of desired characters from your string (variable) substr($your-variable,0,-1); In the above function […]

How to check if a website url is valid – PHP

There are various ways of checking if a given variable of website url is valid or not. However most of they try to get content of the webpage or ping it etc. The way that i prefer to use is by fopen command in a function or separately. Use this code to confirm or verify […]

How to remove extension from a file name using PHP

This code can be used to remove an extension from the file name using php. If manipulated abit, it can also be used to find the extension of php and echo it. function RemoveExtension($strName) { $ext = strrchr($strName, ‘.’); if($ext !== false) { $strName = substr($strName, 0, -strlen($ext)); } return $strName; } $Name = ‘file.txt’; echo RemoveExtension($filename); However, in my case, i tried using it with a bunch of […]

How to code custom submit form in php in wordpress

Today I got an sms from my friend regarding some query related to wordpress custom form coding (through plugin or theme directly) . Although i am sleepy while writing this post, I will try to be as much descriptive as I can. Do let me know if anything in the tutorial is ambiguous. The question […]

Exclude Trackbacks and Pingbacks from Defualt WordPress Recent Comments Widget

The default wordpress recent comments widget shows the most recent comments including the trachbacks and pingbacks too which can be some times annoying or useless in some cases. So how do we remove/hide these trachbacks and pingbacks from wordpress default recent comments widget? as there is no option in the wordpress admin panel widget manager […]

Digg submit new link error – fsockopen related

I have never encountered such an error on Digg before today. As soon as i started receiving this error, i tried searching on google for any previous posts related to this error while submitting a post link to digg by any other site or author, but didn’t get any information. While trying to digg few […]