I have An array which looks like following after using print_r Now I want to write this array direct to a file, I use the file_put_contents method, but I don’t know how to get the data from the file exactly how they looks like original. Any idea to solve this? Answer Your problem at the moment is basica…
Tag: php
Why does Magento keep only the first 1000 products in a category, after saving the category?
Using Magento’s back-office, after saving a category which was linked to many products, only the first 1000 products (or 2000, or x000, depending on host configuration) are kept. All other category/product links are deleted from the catalog_category_product table in the database. This occurs even though…
Create link in pdf with tcpdf
How can I create a link with TCPDF? When using the writeHTML() function and passing my whole html content, TCPDF doesn’t make my links clickable. They are blue and underlined but I cannot click them. Here is what I did. Answer As per the documentation, you can use the Write() method on your TCPDF object…
Replacing text between two limts
I have been trying to get the text between two symbols to be replaced with preg_replace, but alas still not quite getting it right as I get a null output that is empty string, this is what I have so …
facebook Sharer popup window
The FB sharer popup window displays the data of the page, not the metadata I have inserted in the php link. It seems the to be caused by the javascript How can I display the correct data in the popup window? Answer If you want to add custom metadata, use following code: UPDATE: I wrote a little JS code for
Football league scheduling algorithm (with sync. home/away)
I’m making an automatic football league generator and got stuck on schedule. I have an algorithm for generating everything, but not schedule. Take a look: For example: And now when i have got all that data I can just use few foreach() for taking what i need. But – the thing i want is to put teams …
file_put_contents: Failed to open stream, no such file or directory
I am trying to use dompdf to save a form to an easily-readable .pdf file, and my processing script is below. I am receiving the error Warning: file_put_contents(/files/grantapps/NAME0.pdf) [function….
bind_param Number of variables doesn’t match number of parameters in prepared statement
Here is a snippet from my code: When I echo out the values for $year and $make, I am seeing values, but when I run this script, I get a null value, and the following warning appears in my log file: PHP Warning: mysqli_stmt::bind_param(): Number of variables doesn’t match number of parameters in prepared…
Haversine formula with php
I want to use this formula with php. I have a database with some values of latitute and longitude saved. I want to find, with a certain value of latitude and longitude in input, all the distances (in km) from this point with each point in the database. To do this, I used the formula on googlemaps api: Of cour…
Fatal Error – Too many open files
I try to run PHPUnit Tests in my new machine and I get this error: PHP Fatal error: Uncaught exception ‘UnexpectedValueException’ with message ‘RecursiveDirectoryIterator::__construct(/usr/lib/php/pear/File/Iterator): failed to open dir: Too many open files’ in /usr/lib/php/pear/File/I…