Skip to content

Tag: php

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

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. …