Skip to content

Tag: php

UTF 8 and Windows 1254 charset mismatch

I’m using Drupal 7. And i created a block and embed this code: My site charset: And external link charset is: So, when get some info on external link, i have character problem (don’t seen İ, ç, ş etc..) How can i solve this? Answer In your block, I would create these two lines: so this page’…

fputcsv display leading zeros

I’m using a PHP script to generate an excel CSV file from a result-set query. All works fine but when I read my excel file, I can not display leading zeros. This is my code: If I make a var_dump() of $finalData[] I see the correct value, for example ‘000198’, ‘000199’, ‘000…

PHP cURL vs file_get_contents

How do these two pieces of code differ when accessing a REST API? and They both produce the same result, judging by Answer file_get_contents() is a simple screwdriver. Great for simple GET requests where the header, HTTP request method, timeout, cookiejar, redirects, and other important things do not matter. …

MySQL: Group by two columns and sum

Building an inventory system. I have lots of products and each product has three different variables. So for stock totals I want to group by the two columns (product & size) and sum quantity to …

PHP checkdate variants

I found a php function checkdate() , but strangely enough it only seems to accept data in format of int $month , int $day , int $year. However I am passing the date as a string (example “2012-06-13”) …