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:…
Tag: php
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 use Master/Slave doctrine2 configurations from Symfony2 Console commands
I’m using the Doctrine2 master/slave configuration in Symfony2 to scale my application across a single master database and several read-only (replicated) slaves. This works perfectly from within my application and Doctrine2 sensibly uses the slave for read-only queries and the master for write operation…
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…
How do I install / enable the PHP phar extension?
I am trying to install Composer on my KnownHost VPS. When I run this command: I get this error message: How do I install the phar extension? I am running PHP 5.4.22 on my VPS. Answer In the end I solved this by getting my host to rebuild PHP with PDO support.
How to open DB connection in Openshift? [closed]
This is my dbcon file in PHP. Basically, I need to connect my PHP application with openshift MySQL DB. Here’s what I did. <?php // Database Connection Setting $dbhost = "127.0.0.1"; // …
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…
Facebook API php: check if username is set or not
In which way could I check if FaceBook profile username is set or not? Because I’ve created a FaceBook profile for do some tests, but it seems that no username is found from profile. this is my code: $…