Duplicate entry ‘0’ for key 1 – php/mysql error – SOLVED

While working on a script using php and mysql, I encountered an error saying: Duplicate entry ‘0’ for key 1 Duplicate entry ‘0’ for key 1 – php/mysql error This error can be caused due to various issues depending upon the situation and your code / mysql database structure and where is the duplicate entry […]

How to replace a word in whole database using php

In this post you will learn how to change or replace a word in the database using php. To replace a word in whole db using php, follow these steps (php code file attached too): How to replace something in mysql database using php 1. Copy this code and save it as a .php file […]

Switch/Case vs If/Else (in PHP)

Although many programming languages use if/else and switch/case functions for conditional statements, but we’re discussing them here with regards to php specifically. I’ve been asked several times by junior programmers that whats the difference between using switch-case and if-else functions in php. Well, there are many differences. I’ll try to list them out and explain […]

Simple Contact Form Script – PHP

There are various contact form scripts and codes out there on php. I’m going to show you a very simple form which you can adapt according to your needs. The form shows a contact form and once submitted it hides the contact form and shows the thank you message only. A modified version of the […]

LinkedIn->updateNetwork(): profile data could not be retrieved – Solved

I’ll be honest, this was my first day working on Linkedin API for creating an app with numerous functionalities in it. I utilized OAuth library along with simple-linkedinphp – a simple Php-based LinkedIn API library to connect and perform various functions with linkedin profile. However while playing around, few errors came up. One of them was: “LinkedIn->updateNetwork(): […]

Convert XML string to PHP Array

PHP programmers usually require to convert xml data to php array to store or use it in their classes methods and functions. Now its a different discussion why can’t they use xml data directly without having to convert xml to php array. In a project today, I needed to convert the xml data to php array […]

Do you license your scripts before giving it to the client?

If you’re a programmer or developer, you might had numerous events in your life in which the client didn’t pay you for all your hard work. Happens to me too! I’ve been planning for long to start licensing and sort of encrypting some part of the scripts to the clients who don’t pay advance (or […]

How to show specific post(s) in WordPress

Sometimes we need a code for our wordpress plugin to show a specific post from the database. It could be dynamic though, but only 1 specific post. You can use this code to show a specific post on your wordpress homepage or specific page / widget. Please note, this is the basic code that you […]

[Solved] Fatal error: Call to undefined function the_post_thumbnail() in . . .

Today i was working on a WordPress based website which needed a custom featured posts widget to be created when I received some error. The widget used this code to get the post thumbnail: <?php the_post_thumbnail( array(87, 112, true) ); ?> Let’s not go into much details of this function (you can find it in […]