I have a server which holds TIFF images. Most clients can read and display TIFF images, so there’s no problem. However, some clients can’t handle this format but can handle JPG. I thought of using PHP’…
Tag: php
How to merge Laravel objects in controller
I have a controller where I want to combine data from multiple tables with parallel structures. What I want to end up with in the end is one object I can return from the controller so I can parse it …
FTP upload via PHP form
I want to upload a file via FTP upload in a form. Here is the PHP file: The FTP connection connects successfully but the file is nowhere. Can anybody help me? Thanks! Answer Because you have <input name=”uploadedfile” type=”file” />: Because you need the filename of the temporary…
Force PHP to execute include even if there is an error later in the script
I am trying to create a system where by adding one include, I can set PHP to display errors (the php.ini file prevents this). In other words: This would create a parse error and “showerrors.php” does not get executed, meaning that the error never gets shown. However, if “showerrors.php”…
How to create a custom JSON layout from MySQL in PHP
I have a MySQL query in PHP that pulls back two columns of results Column One is Label Column Two is Value I have read http://nitschinger.at/Handling-JSON-like-a-boss-in-PHP but im struggling to understand how I can do the following JSON in PHP from MySQL I can manually write a loop to output the raw text to …
Elegant way to search an PHP array using a user-defined function
Basically, I want to be able to get the functionality of C++’s find_if(), Smalltalk’s detect: etc.: But I don’t know of any PHP function which does this. One “approximation” I came up with: The downside of this is that the code’s purpose is not immediately clear. Also, it w…
Using the “new” keyword in constructors
I’ve recently read that using the keyword “new” in a constructor is highly frowned upon, but I’m not sure I understand why? For example, how is: class A { public $foo; function __construct() …
How to show time with php code with the right timezone
I need to show current time on my site in my city Iran/Tehran I’m using this code: but it doesn’t show the right time. my country timezone : iran/tehran my city …
php – detect if email is sent
Im building an automated newsletter, im kinda stuck with this problem. I need to know if the email was sent or not. Here is my code @$send = mail($emailRecipient, $subject, $message, $headers); i …
Salesforce to magento integration
This is my code… I am just trying to create a lead in salesforce using this code. This is a sample php toolkit code for salesforce. But when I am trying to run this code. It does not generate any lead in salesforce. My login credentials are correct and security token is also correct. Where am I going wr…