Install Composer in XAMPP/WAMP Windows

Leave a Comment
Composer Installation for windows users is very easy. All you need to do is just download .exe installer file from the Composer site.
Here is the .exe installer link to download Composer-Setup.exe
Once you downloaded .exe file, then click on it to continue installation and follow the default Composer installation instructions.

You can also install the Composer using curl using following command

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === 
'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae')
 { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } 
echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Once you successfully installed the Composer. Then open your command prompt then type composer and press enter in the terminal you will get following response like in the below image.

Export MySQL SELECT Query into CSV File

Leave a Comment
Sometimes we need to export MySQL SELECT query results into CSV format for testing or some other purpose. Here we are going to see how to output MySQL query results in CSV format.

We are going to use SELECT ... INTO OUTFILE MySQL query to store MySQL SELECT query results into CSV format.

 This SELECT ... INTO form of SELECT enables a query result to be stored in variables or written to a file: We can use SELECT ... INTO in following three way.
 SELECT ... INTO var_list selects column values and stores them into variables.
SELECT ... INTO OUTFILE writes the selected rows to a file. Column and line terminators can be specified to produce a specific output format.
 SELECT ... INTO DUMPFILE writes a single row to a file without any formatting. 

Here is the SELECT ... INTO OUTFILE MySQL query outputs the results into CSV file in the specified location.

SELECT id, country, capital FROM `countries`
INTO OUTFILE 'C:/Users/muni/Desktop/countries.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';

 

Add/Set Windows Environment Variable Path

Leave a Comment
In this tutorial we are going to set Environment Variable Path for MySQL utilities. Please follow below steps.

Step 1:
 Right click on Computer and Click open properties.
Step 2:
Next click Advanced system settings, it will open new window. Now click on Environment Variables.




Step 3:
Now select Path from System variables  then click on edit button.



Step 4:
Finally copy your path value you want to add and add it in the end, If semi colon not exists, then add like




NodeJS and Npm Proxy Settings

Leave a Comment
If you are behind the proxy, then proxy will block your package installation. It may throw errors like this.
  1. Tunneling socket could not be established cause=getaddrinfo ENOTFOUND.
  2. In most cases you are behind a proxy or have bad network settings

NodeJS and Npm Proxy Settings Error
NodeJS and Npm Proxy Settings Error

Node package manager (NPM) uses the configuration file over the environment variable we set in windows system. So we need set proxy (http-proxy, https-proxy) in the Node configuration file using following commands. 

​npm config set proxy http://proxy.com:8080
npm config set http-proxy http://proxy.com:8080
npm config set https-proxy https://proxy.com:8080

If npm still have any issues then set registry using following command.


npm config set registry http://registry.npmjs.org/

If still you have any issues then close your command terminal and open it. Now try with npm install command

Install WordPress in Localhost

Leave a Comment
Step 1:  Download the Wordpress set-up from the following link.

 https://wordpress.org/download/

Step 2:

 Now create a directory called "wordpress-site" in the root of the server (I am creating in htdocs/www folder).


Now extract the download Wordpress setup files and copy the extracted files into "wordpress-site" directory.


Step 3:  Now access your site using following URL "http://localhost/wordpress-site/" in the browser. Now Wordpress will automatically redirect you to the installation page.

now click on continue.
Now click on Let's go!.

Step 4: Now create MySQL database for Wordpress Site. Go to your PHPmyAdmin and create database like this.


Once you successfully created the database, now go your WordPress installation page, where we left. and give give your database credentials.

I have given default MySQL database username and password (root/), and click on submit. If you are given correct database credentials then you will see following page that says WordPress can able to communicate with MySQL database.

click on "Run the install" button to continue.

Step 5: Finally give your site specific credentials like sitename, site username& password and email.

Now click on "install WordPress" button to complete the WordPress installation process. Now you have successfully completed the WordPress installation on your local machine.



Invoice Script Using PHP MySQL jQuery and Ajax

Leave a Comment
Smart invoice makes your invoice generation and invoice maintenance so easy for your stock management system. Invoice script PHP is created to save the time for Invoice generations when there are numerous products or clients are engaged in your business. Lesser your employees and manage your stock by just making few clicks and presses. You may get tired of typing Invoices for each and every company throughout the day, even if they are your old customers, but our free Invoice Script will store your customers details such as Name, address, etc., so that the very next time when you try to enter their details it will be profiled in dropdowns and makes your job even simpler. 


The dashboard of this Invoice generator gives you options like Managing Clients, Managing products, Signature of your company in settings, etc.,. Managing clients will show your existing customers from the database through which you can edit their information such as company name, phone number, address, etc., and also you can add a new client to your database right from here. Product management displays your existing product details from the database which gives way to edit things such as product code, product name, prices, etc., where here you can obviously add new products to your stock. Settings page of this Invoice software has some fields to enter your company details like company name, logo, address, etc., to get printed on your Invoices every time when you print it out. 




This Invoice script in PHP is mainly used to create invoices instantly for numerous products with the inclusion of tax percentage for each invoice. When you try to generate your invoice through this software there are some special options for you to notice. Once you enter Price of an Item, quantity and its Tax percentage then it will automatically fill up the fields such as Tax amount and Total amount. This Invoice script also calculates the balance amount that is yet to be paid when the Amount paid field is entered. Along with this obviously you can write some descriptions about the invoice on the given space for your future references.  Apart from all the above usages this Invoice script open source helps you to retrieve the invoices for both hardcopy and softcopy. Meaning that you can edit and take a print out of those Invoices, save them as pdfs and also you can email every invoice. 


Invoice script helps you here to reduce:
1.    Employment
2.    Time
3.    Pressure


We are providing Invoice script as open source for your system to make use of the script to enhance your management easier and simpler, moreover, you can also use our entire application to manage and maintain your stock management system.  So as said prior, this Invoice software is there to help you in creating invoices instantly for any large number of products and keep track of your clients based on their products. One time usage of this script will make you feel very comfortable in using it for all your businesses globally.

Wordpress wp_localize_script

Leave a Comment
Wordpress offers wp_localize_script() function to assign some value from php to Javascript. This wp_localize_script() function makes any php data that's directly available in JavaScript.

<?php wp_localize_script( $handle, $name, $data );  ?> 

Where $handle – refers to script file
           $name – refers to name of the JavaScript object.
           $data – where we can specify list parameters for that JavaScript object ($name) going to have.

For example I want following php data you want in ajax.js file. So we need to do following things.
// Register the script
wp_register_script( 'ajax', 'path/to/ajax.js' );
wp_localize_script( 'ajax', 'php_data', array( 'name' => 'muni' ) );
// Enqueued script with localized data.
wp_enqueue_script( 'ajax' );

While your page is excuted it will generate following scripts in your page.
<script type='text/javascript'>
/* <![CDATA[ */
var php_data = {"name":"muni"};
/* ]]> */
</script>
<script type='text/javascript' src='http://localhost/developersguide/wp-content/themes/developersguide/library/js/ajax.js'></script>

So we can easily access that php data in JavaScript like below.
<script>
alert( php_data.name);
</script> 

To know more about please refer following Wordpress Forntend Login Tutorial.

 Light Weight WordPress Frontend Ajax Login and Registration