Tag Archives: web development

Php array of iso 639-1 language codes and names

By | September 2, 2023

Here is a php array containing the language codes and language names as specified by the iso 639-1 standard. Useful when . <?php /** ISO 639-1 Language Codes Useful in Locale analysis References : 1. http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes 2. http://blog.xoundboy.com/?p=235 */ $language_codes = array( 'en' => 'English' , 'aa' => 'Afar' , 'ab' => 'Abkhazian' , 'af'… Read More »

PHP : Add Login with Github to your website

By | May 9, 2020

Github Login Github has become a very popular social login on websites related to programming and development. Github itself is a big storehouse of opensource projects and community of developers. Github oAuth documentation can be found at http://developer.github.com/v3/oauth/. Register website with Github oAuth The first thing to do would be to register your website with… Read More »

Use clientside ssl certificate with curl and php

By | June 13, 2012

Clientside certificates are often used in soap webservices. For example the wsdl file link might require a clientside certificate. The server throws an error like this : HTTP Error 403.7 – Forbidden: SSL client certificate is required. Curl Command To use clientside certificate with curl , test the following command curl –cert certificate_file.pem https://www.example.com/some_protected_page or… Read More »

40+ Useful Php tips for beginners – Part 3

By | April 7, 2012

Part 2 26. Avoid direct SQL query , abstract it $query = &quot;INSERT INTO users(name , email , address , phone) VALUES('$name' , '$email' , '$address' , '$phone')&quot;; $db-&gt;query($query); //call to mysqli_query() The above is the simplest way way of writing sql queries and interacting with databases for operations like INSERT, UPDATE, DELETE etc. But… Read More »

Php get zip error message from error number

By | November 24, 2011

Php functions like zip_open return an error number if they fail. To get the corresponding error message from the error number , use the following function. function zip_error_message($errno) { // using constant name as a string to make this function PHP4 compatible $zipFileFunctionsErrors = array( 'ZIPARCHIVE::ER_MULTIDISK' =&gt; 'Multi-disk zip archives not supported.', 'ZIPARCHIVE::ER_RENAME' =&gt; 'Renaming… Read More »

PHP strtotime in 64 bit environment

By | October 23, 2011

The strtotime function is used to convert a date in various formats to a timestamp. However its behaviour is different based on architecture it is running on, whether 32bit or 64bit. Lets take a few examples : In 64 bit environment desktop:~$ php -a Interactive shell php &gt; echo strtotime(&quot;0000-00-00 00:00:00&quot;); -62170005200 php &gt; echo… Read More »

How to List foreign keys in Mysql

By | November 14, 2023

information_schema The following query will list out the foreign keys in mysql. It finds it out from the information_schema database. select concat(table_name, '.', column_name) as 'foreign key', concat(referenced_table_name, '.', referenced_column_name) as 'references' from information_schema.key_column_usage where referenced_table_name is not null; The output is a clean table listing out all foreign keys from all databases +———————–+————-+ |… Read More »