Skip to content

Tag: php

phpexcel -How to change data type for whole column of an excel

I’m trying to change the datatype for a whole column (for eg: i need to change for “M” Column to general format). Its displaying as 2.00 in quantity field,I need to change this whole column to general format ie. display as “2”. But its not changing the datatype. Here is the code:…

Switch multiple case statement

Can someone suggest me how can I replace the below code? How do I rewrite the code in order to avoid the repetition of the block case 3:{code block A; break;}? How can I have combined code for case 1 and case 3? Answer This format is shown in the PHP docs: EDIT 04/19/2021: With the release of PHP8 and

Need help converting PV formula to PHP

I need help converting the following excel formula to PHP PV(.0588/12,300,868.0583333) The output I am expecting is 136,275.88, but the output that I am getting is 590573.166. I have spent hours on it but I can’t seem to find the solution. This is my code I have gone through the similar post before but …

How to give apache permission to write to home directory?

My server is in /var/www/html I have a php script in /var/www/html/fileio_test/io_test.php When I try to run this script I get How do I let apache write to my home directory? The server runs on fedora 20. Answer As your file residing in your Home directory, I would suggest one of following approaches. Give 07…

Update specific row using codeigniter?

I am trying to update specific row of table in codeigniter. But my code update all rows. Model: Controller: And in new page it show the echo value 1. How to update specific row? why $query->num_rows() return 1 and update all rows? Answer Try using a where condition to update a specific record

How to install ImageMagick for PHP5.3/5.4 on Windows 8 x64

I need install ImageMagick for PHP 5.4.7 on Windows. How do I install it? Answer Step by step: Download the binary version for Windows Install you binary version. Test you install in CMD Execute convert in CMD. If this work, the intall is success. Now, download Imagemagick DLL for PHP Open imagemagick-php54-p…