Trying to concatenate:
Tag: php
PHP: If number (with comma), convert it to right number format (with point)
I have an array of mixed values: As you can see it contains text and both negative and positive comma-numbers. I need to convert the numeric values to the right number format and leave the text values as is. Now I’m looping over the values: Two related questions I’ve investigated but cannot find a…
XAMPP PHP date function time is different from local machine time
My computer local time is 12-03-2013 4:30pm. My XAMPP date function prints the time as 12-03-2013 10:49:56. How can I set the XAMPP server time to display the system time? Answer Go to C:xamppphpphp.ini, or your custom path where php.ini is, open it. Look for the following: date.timezone = “Europe/Warsa…
Gettext or database translation
Which is better: gettext custom MySQL+cache based functionality Gettext is a sort of builtin feature, so I assume it’s tweaked for performance. Using poedit is a pain and impossible to show to any client. A custom functionality allows for simple translation interface. But might be heavy on php/db usage.…
PHP Classes: Should I use 2 classes or 1?
I am currently trying to make a class that deals with a survey in PHP (Drupal). So far I have this: This is great, I can create a new instance of Survey, set the properties, and call save on it. However, I also want to be able to have methods that retrieve the results of these surveys from the DB
How to export some rows of a MySQL table from a WHERE clause?
How to export some rows of a MySQL table with where clause from a PHP script? I have a MySQL say test and I want to create a importable .sql file for rows where id are between 10 and 100, using PHP script. I want to create a sql file say test.sql which can be imported to MySQL database. Mycode:
Add radio button selection to database via ajax?
When I test my form it adds data successfully to my database table but the radio button selection is always “Ungrouped” which is the first radio button in the group. I tried giving them separate id’s, but in my ajax.js file my function uses this: Which means that now I am calling an id that …
Why is ${0x0} correct?
The following code is working perfectly: But I can’t figure out why. 0x0 (or 0, as non-hex people call it) is a random container, it could have been any number, but php variables can’t start with a number. What’s so special about the { } used here, and what are their limitations ? Answer Fir…
Grouped Products with Individual “Add To Cart” Button (Magento)
I am trying to set up a grouped product in Magento. What i am trying to accomplish is to add “add to cart” – button behind every grouped option that adds only this product to cart and not the hole grouped product. I have managed to get “read more” buttom to work with This will show product. …
PHP Mail header for emails with special characters in the subject or message
My code: $to = ‘example@example.com’; $subject = $_REQUEST[‘subject’] ; $message = $_REQUEST[‘message’] ; $header = “From: noreply@example.comrn”; $header.= “MIME-Version: 1.0rn”; $header.=…