php

C++ #define in PHP

I realize that "eval" largely fills the role of the C++ #define feature, but how would I do something like this in PHP: #define D(x,y) if (N==x) return(y); else { void Sample(int N) { D(3) D(4) D(22) } } } My problem is that eval("return;") will just return from eval, not from the calling routine. My other problem i...

Magento Store - Automatic Currency

In my magento store is it possible to set the currency depending on the users location as opposed to using the base currency specified in the site config? Thanks! ...

PHP: Why typecast with !!$var instead of (boolean)$var?

Both of these will ensure than $var is a boolean value, but the latter seems more clear. The double exclamation mark (!!) is shorter to type but less clear, and more likely to cause confusion. Not to mention hard to run a search on to get answers. The double exclamation mark is something I've only heard of in JavaScript, which doesn't...

Drupal session help needed...

Hi! I am working on a drupal based website. I am creating a shipping solution to be added to the drupal app. we want to use a common login for both shipping solution and drupal . how can we manage the session of drupal with the shipping ? regards sd ...

gnokii working in linux command line but not in php system command, pls, help.

gnokii working in linux command line in rhel5 but not through php system command, what to check? pls help. ...

Where should i start before using codeigniter with php?

Hai guys, As i am a newbie to codeigniter with php i dont know where to start please guide me with some useful links... ...

Application processes + Triggers. Is it good?

Almost in all stages of my application, the database inserts / updates / deletions are done by the application code (in my case, PHP). However, in some situations, I am using MySQL triggers to do some calculations and changes to the tables. Is this a recommended approach? Or is there any best practice rule that only the application sho...

How to to remove certain colors from an image with PHP or Ruby?

Say there are 3 circles: red, blue, black. I only want the black circle to remain. How can I remove the red and blue circles? ...

PHP Tag Cloud System

Hi, I am implementing a tag cloud system based on this recommendation. (However, I am not using foreign keys) I am allowing up to 25 tags. My question is, how can I handle editing on the items? I have this item adding/editing page: Title: Description: Tags: (example data) computer, book, web, design If someone edits an item details, ...

How to remove folder with PHP?

I can create a image folder when I create a category, so that I can upload images there. Now I want to delete that folder when I delete the category. Code for creating a folder is the following and works well. function create(){ if ($this->input->post('name')){ $this->MCats->addCategory(); $folder = $this->input->post('name');...

embedded php code in html being displayed

i bought this php script and all the pages are in .html when I upload it to my ubuntu server and access the site, the php codes are literally displayed along with the html.... what gives ? how to fix this ? ...

How to get the download speed using php

Hi All, I need to get the download speed of the user visiting my site, Is it possible with PHP? If so, How to do that?. Please advice.. Thanks in advance. ...

How to start to dev a Web Directory System

Hi Guys. I am planing to build a simple web dictionary system with Kohana 3. categories . website title; . website URL; . website logo; . website description. . etc. How to write a professional design specification for my project and is there any good tutorial to start? Appreciated for reading and the replies. ...

PHP's Dot Equals `.=` operator in Javascript?

How can you use PHP's Dot Equals .= operator in Javascript? ...

mysqldump fails because there is a space in the directory name. Doze issue.

Not sure whether to post this in Apache, PHP or MySQL but I'm having an issue with the path as I am feeding into a mysqldump command. There is a space in my path and that is what is causing me grief. I know it needs to be quoted but no matter how I try and quote it, I either get PHP errors or mysql errors telling me that the path cannot ...

Starting Apache service with a variable that can be later accessed via PHP?

Hi, I have a need to start the Apache service with a parameter so that I can later access that parameter via PHP. Is this possible? ...

Php page refresh , get the post values from formm

i got a jquery upload and crop script and i am trying to use it. First i have a 1.html file which has a form, which requires some texts and image. After submitting the form it goes to main.php where it checks for some image properties and if successful it refreshes the page using header("location:".$_SERVER["PHP_SELF"]); So if i place...

Query string used for AJAX not refreshing.

I used following code to dynamically fill DropDown controls using AJAX. Each time a DropDown control is clicked, following statement transfers the query to an AJAX function which then forwards to a .php file to retrieve the database results. The problem is that the same code works absolutely fine when used on the local machine even if t...

php remove button keeps retreiving posted information

Hi every1! im quickly finding im quite the beginner to php, so please bare with me! I have a quick problem, I have a remove button for a shopping cart and the code works for it everytime except for the last product thats in the cart. If a person pushes the addtoCart button the URL is reloaded with ?buyproduct=$productNumber and when the...

file_get_contents with query string

i am trying to send email from php i have one php file with all values & other php template file. (both files are on same server) i am using file_get_contents to get contents of php template file for example $url="emil_form.php"; $a="uname"; if(($Content = file_get_contents($url. "?uname=".$a)) === false) { $Content = ""; ...