Author Archives: Andrei

How to do a batch insert in MySQL?

mysql feature

How to do a batch insert in MySQL? In this tutorial, I will present you how to do a batch insert in mysql. Let’s say you want to insert some informations from an array into the database. In order for this to work efficient, you should have more than one information in that array. Why

Disable temporary a foreign key constraint in MySQL

snippets

Disable temporary a foreign key constraint in MySQL Were you in the situation of having a mysql table and wanted to delete some records from it, but you were not allowed due to the constraints of that table? Don’t worry, me too. Or if you use foreign keys in your database tables, you’ll probably have problems

How to sort a multidimensional array based on key?

snippets

How to sort a multidimensional array based on key? First of all, let’s give credit to the person who wrote this function. The problem ? Let’s say you have a multidimensional array and you want to sort based on a key that is not on the first level of the array, how would you do

How to detect a page refresh with PHP?

snippets

How to detect a page refresh with PHP? Sometimes you want to detect if the page was refreshed using “F5” key, or right click and “Reload” or any other method available. Either way, this can be detected somehow from server side. In this snippet, I will show you how to do this with PHP. Method

6 free mobile device emulators for testing your app

responsinator

6 free mobile device emulators for testing your app If you made at least one website that was responsive, you certainly know how important these tools are. Here is a list with helpful websites in which I tested my apps during and after development. This is NOT a top, just a list. 1) Responsinator Responsinator

Symfony mapped entities error while generating getters and setters

snippets

Symfony mapped entities error while generating getters and setters If you ever used Symfony php framework, and you wanted to generate through command line the setters and getters for your entity after you defined everything in your entities files, and you got an error like this:

you probably want to know the solution of

The controller for URI is not callable in symfony

snippets

The controller for URI is not callable in symfony This is a very common error for symfony starters, and it happened to me also when I first tried the framework, so you have to follow two steps in order to debug this: First check First step is to make sure that your controller is actually

How to redirect URL in Javascript or jQuery

snippets

How to redirect URL in Javascript or jQuery I will present some ways to redirect the user to another page from the client side using only plain javascript. 1) Using window.location.href you obtain a similar behavior  as an HTTP redirect

2) Using window.location.replace

window.location.href VS window.location.replace It is better than using window.location.href, because replace() does not put

Change value of selectbox in Zurb Foundation via JavaScript

snippets

Change value of selectbox in Zurb Foundation via JavaScript Some of us tried to change or will have to change via javascript a select-box that is generated from the custom forms of Zurb Foundation  framework. You noticed or you will notice that it is not as simple as changing a default html select-box. Why ?

How to invoke dynamically a class method in PHP?

snippets

How to invoke dynamically a class method in PHP? Today will talk about calling a method from inside class, however you are in the situation of calling a method dynamically in a loop, for each element of an array. To do this we will make use of a php function called call_user_func.Using this function, you

Request an article ←