Converting words to numbers in PHP

Welcome back to shorltearner.com, we are starting a new series of PHP interview questions for beginners and experienced,so in previous post we learn, Write a PHP program to check if the bits of the two given positions of a number are same or not
In this post we see how to Converting words to numbers in PHP.
Also Read
Unable to create a directory a wordpress error
PHP program that multiplies corresponding elements of two given lists
PHP program to print out the multiplication table up to 6*6

convert number to words in php

how to delete a file with the help of PHP

Welcome back to shortlearner.com, in this post we will see how to delete a file inside the directorywith the help of PHP.

delete a file using php

so its quite easy to delete the files inside the directory with the help of a single predefined PHP function. PHP provide us a predefined function unlink.
with the help of this function we can easily delete the files from our directoryso in the below example we should try to learn how the unlink function works.

Also Read :
Get Domain name from URL
How to Send Attachment on mail using PHP.
PHP Login Script With Remember me.
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?


so here i am creating a variable $file_pointer , in the value of this variable we put the file name which we want to delete from our directory,

so in the below example i want to delete myfile.php from my directory so i put this inside the value of variable.

and put this variable as a parameter into unlink function
. whenever i run this file, the unlink function works and delete the myfile.php file from my directory.

How to read and insert an excel file data into MySQL.

Welcome back to shortlearner.com, in this post we will learn how to read an excel file and insert the excel data into MySQL with the help of PHP Excel library.

read and insert an excel file data into MySQL

 Now a days i am working on a project of one of my client and he has a bulk amount of data in excel(.xlsx) format.
he wants to insert all his data into database using single process to save his time.

Also Read :
Get Domain name from URL
How to Send Attachment on mail using PHP.
PHP Login Script With Remember me.
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

Hence, we have created a process which fulfills our client requirement.
So, in this post we are going to share the way

how we can achieve the same. You can also try the same way which will save your time and easy to implement.


Below is the example of inserting excel data into mysql with the help of PHPExcel library.
Short overview of our working flow:


1.Create database and it’s tables.
2.Download php excel library.
3.Write a code which helps to import data into database and also shows the excel data into our webpage.


Here is the way to implement the flow :
We are creating a database named jyotishi and also creating a table ank_jyotishkosh into our database.

we move to our second step and download the PHPExcel library click here to download PHPExcel library .

We are creating a config.php file, which helps to make a connection to our MySQL database.

Now we are creating another PHP file where we write a code for import data into database and shows the data into web page as well.

we are creating a form in bootstrap which takes excel file from user and also add some bootstrap maxcdn files and custom CSS as well.

In the above code you can see a php variable $output at the end of the code, which will use for showing excel data into web page.

Now move to the next step, when user hit on the import button then it checks whether the file is in the excel format or not.


If the file is in excel format then we move further otherwise it will show an error message and requests user to select valid excel file.

If user select valid excel file then we will include our php excel libaray into our code.

We put our data into PHP variable with the help of foreach loop and then shows in a table format and write an insert query which insert our data into database too.

Note : When you run this code and got some error then please make sure you have enabled zip extension on your server.This is the common error which we receive.


If you would like to know how to check whether extension is enabled or not, please check our post on how to enable extension on server.


Keep learning.
Stay connected with us for any queries.

Enable PHP Zip Extension through cPanel

Welcome back to shortlearner.com, in this post we will see how to enable PHP ZIP extension on cPanel.
before start this tutorial, we should take a overview about PHP extension.
so basically PHP extension enables you to transparently read or write ZIP compressed archives and the files inside them.

how to enable extensions in cpanel


and most of the time it is disable by default in cPanel , so we have to manually install it.
So just follow the steps and install these extensions manually.
Note: try to follow snaps for better understanding.

step 1: So in the very first step , we should login into our cPanel(Control Panel) and than go to the software section
Step 2: in the software section click on PHP Pear Packages

Enable PHP ZIP Extensions in cPanel

Also Read :
Get Domain name from URL
How to Send Attachment on mail using PHP.
PHP Login Script With Remember me.
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

Step3: after clicking on PHP Pear Packages we are searching our ZIP extension and install it.

enable php extension

step 4 : After installing the package we should again go to our software section and click on the PHP version .

install zip archive

Step5: once we click on the select PHP Version, we can see all the enable extension over there, and we can see our Archiv_ZIP as well. so we just checked it and hit on the save button to add archive_zip in our current PHP version.

enable php zip extension

Step5: now the last and very important step we will follow to complete this tutorial.again go to the software section and click on the PHP processes and hit the kill process button.

zip enable in cpanel

Now we can use your PHP ZIP Extension our website.

Send forgot password by mail script in PHP

welcome back to shortlearner.com, in this post we will see how to send forgot password on mail with the help of PHP.
So in the very step we establish our database connection in connection.php file than we include it in our send.php file.
connection.php

orgot password in php

index.php
Also Read :
PHP Login Script With Remember me.
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

style.css

send.php