Category Archives: PHP

Php Interview Questions and Answers – Part 3




1- What is the difference between CHAR and VARCHAR data types? CHAR is a fixed length data type. CHAR(n) will take n characters of storage even if you enter less than n characters to that column. For example, “Hello!” will be stored as “Hello! ” in CHAR(10) column. VARCHAR is a variable length data type. VARCHAR(n) will take only the required storage for the actual number of characters entered to that column. For example, “Hello!” will be stored as “Hello!” […]

Manual Order Maker tep_get_address_format_id error fix




when I choose create order -> I can select a customer (or create a new one..) but when I hit the save button I get the following error message: Fatal error: Call to undefined function tep_get_address_format_id() in /xxx/xxx/xxxxx/catalog/admin/create_order_process.php on line 42 Here is line 42 of my create_order_process.php: $format_id = tep_get_address_format_id($country_id); Contribution link: http://addons.oscommerce.com/info/4829 Here is fix solution: Change this line: tep_get_address_format_id($country_id); To this: $format_id = “1”; /////////////////////// To complete this fix you would need to copy the function “tep_get_address_format_id” […]

Wrapping Text in PHP




Sometimes we need to wrap text to exactly accommodate a certain width of text or allowing browsers to wrap text whenever required. You can use PHP’s wordwrap() function to wrap a string into new lines when it reaches a specific length. This function limits text display to a particular column size, thereby allowing precise control over how text is rendered on a Web page. By default, wordwrap() wraps strings at column 75 using the standard newline sequence. Below example is […]

Order Editor tep_add_base_ref AJAX ERROR FIX – osCommerce

oscommerce




Fatal error: Call to undefined function tep_add_base_ref() in /home/XXXX/public_html/XXXX/admin/edit_orders_ajax.php on line 1149 For those who have this problem:add below code to admin/include/function/general.php before closing tag ?> function tep_add_base_ref($string) { $i = 0; $output = ”; $n=strlen($string); for ($i=0; $i<$n; $i++) { $char = substr($string, $i, 1); $char5 = substr($string, $i, 5); if ($char5 == ‘src=”‘ ) {$output .= ‘src=”‘ . HTTP_SERVER; $i = $i+4;} else { $output .= $char; } } return $output; } /////////////////////////////////////////// You are done! Thank you […]

Php Interview Questions and Answers – Part 2




1- Why doesn’t the following code print the newline properly? <?php $str = ‘Hello, there.nHow are you?nThanks for visiting techpreparation’; print $str; ?> Because inside the single quotes the n character is not interpreted as newline, just as a sequence of two characters – and n. 2- Would you initialize your strings with single quotes or double quotes? Since the data inside the single-quoted string is not parsed for variable substitution, it’s always a better idea speed-wise to initialize a […]

Bad SEO You Avoid




Whenever I think about pure SEO, I always feel pity that lots of bloggers, webmasters and SEOs (search Engine Optimizers) are still out of track while practicing SEO (Search Engine Optimization). I call it bad SEO practice, which is meaningless, without any results, and resulting in loss of time, energy and money. The main aim of SEO (Search Engine Optimization) should be Conversion, Customer engagement, Brand awareness and Better ROI. SEO is not about improving Alexa Rank or Page Rank.. […]

Php Interview Questions and Answers – Part 1




1- What’s PHP ? The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications. 2- What Is a Session? A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests. There is only one session object available to your PHP scripts at any time. Data saved to the session by […]

Use CAPTCHA on Your Blog




CAPTCHA stands for – Completely Automated Public Turing test to tell Computers and Humans Apart. Just like the name, it makes your blog visitors puzzle. Every time a visitor fill a verification form (figuring out the distorted text), it triggers a chemical reaction in the users’ Limbic System of the brain which analyzes all types of user experience and send  a signal to the memory area of the cerebral cortex. Finally, due to remembrance of poor usability factor, lot of […]

Google Exact – Match Domain – SEO




Do you have an exact-match domain? Most webmasters have domain names which are exact-match keywords to reap the benefits of SEO. Because, till today, Google has been ranking exact-match domains higher in SERPs. That’s why webmasters were always looking for their niche-keywords while registering domain names. Suppose, I’m a an SEO service provider and based in INDIA. So, my exact-match domain name will be like SEOServiceIndia.com. If somebody searches for a phrase like SEO-Service-India, then Google was giving higher rank […]

Category search box anywhere in osCommerce




There are two different types of search boxes to choose from, either a standard search box or an advanced search box with category selection. Each type uses advanced search and each has three options to choose from, a search box with a standard submit button, your site’s default search image button, or no button. Code is provided for each type of search box and each option. A picture of each search box is also included with the code snippet. Installation […]