php

implementing "update if exists" in Doctrine ORM

I am trying to INSERT OR UPDATE IF EXISTS in one transaction. in mysql, I would generally use DUPLICATE KEY ("UPDATE ON DUPLICATE KEY".) I'm aware of many solutions to this problem using various sql variants and subqueries, but I'm trying to implement this in Doctrine (php ORM). It seems there would be Doctrine methods for doing this...

How do I sudo environment?

I am using spamassassin in a php script, but when I train spamassassin as my user the php script's exec command to call spamassassin get the untrained version because of the user specific nature of sa-learn. So I need to sudo to my user in the exec command and get the environment of my user along with the premissions ...

converting & to & for XML in PHP

I am building a XML RSS for my page. And running into this error: error on line 39 at column 46: xmlParseEntityRef: no name Apparently this is because I cant have & in XML... Which I do in my last field row... What is the best way to clean all my $row['field']'s in PHP so that &'s turn into & ...

Which technology stack would result in easiest deployment for a customer-hosted web app?

For a web-app product which would need to be installed by the customer on their own servers (think FogBugz or the self-hosted Wordpress package), which technology stack would result in a smoother/easier installation? Our target platforms are known: Windows/IIS/SQLSever and Linux/Apache/MySQL. But the technology stack to be used is bein...

How to solve the problem with the use of deprecated function ereg() of PHP 5.3.0 in Drupal 6.13

Anyone knows how to solve the error below ? Deprecated: Function ereg() is deprecated in C:\wamp\www\includes\file.inc on line 895 It is happening after installing Drupal 6.13 on wamp server 2.0i with PHP 5.3.0 ...

PHP - Excluding blank rows when printing a table

The code below works great. It prints out items in a MySQL database as an HTML table. However, the database has entries where the first column (the variable "site") is blank. How can I have this table exclude rows / entries where "site" is blank? $result=mysql_query("SHOW TABLES FROM database LIKE '$find'") or die(mysql_error()); i...

Comparing Multidimentional arrays in PHP

Hey everyone, I am trying to compare to multidimentional arrays, but I can't just use array_diff_assoc(). The arrays I am trying to compare are both associative arrays, and they are both sorted so the keys are in the same order. For the most part the arrays are identical in structure. I can't seem to figure out how to compare the ele...

SQL query for Calculating Total No. of Orders per Day?

Hello Can anyone post a SQL query for Calculating Total No. of Orders per Day? Here are the Columns along with their data in my Database. order_id order_placed_date order_total - 1 12/30/2008 12:06:24 AM 2499.99 - 2 2/3/2009 1:57:17 AM 199.99 - 3 2/3/2009 1:58:27 AM 449.99 - 4 5/3/2009 1:58:48 AM 299.99 ...

Looking for cheap or free payment processor integrator

I've done quite a bit of searching but have yet to find anything like this: http://www.nsoftware.com/ibiz/epayment/ Does anyone use anything similar to the one above? I'd just like a "universal" payment processing system with support for the major gateways. ...

Drupal 6.13 Installation - Database Error

I'm using Wampserver 2.0i with php 5.3.0 to install Drupal 6.13. During the installation I'm receiving the message below during the "Set up database" phase Operations on Unicode strings are emulated on a best-effort basis. Install the PHP mbstring extension for improved Unicode support. (Currently using Unicode library Standard PHP) ...

Zend Framework problem with Zend_Layout

How can I create something like: $this->layout()->sidebar, I'm trying for about 4 hours...but it doesn't work for me!Can you give me an example? ...

Setting up a web interface to http proxies?

I want a way to allow users to go through my http proxy server (Squid, Privoxy, etc.) without having to type the IP/port in web browser settings. I was hoping I could use a simple web interface. I'm envisioning this: User goes to a website on my server (http://proxy.com) and types a URL into the form. The user's browser URL ...

PHP equivalent to Python's yield operator

In Python (and others), you can incrementally process large volumes of data by using the 'yield' operator in a function. What would be the similar way to do so in PHP? For example, lets say in Python, if I wanted to read a potentially very large file, I could work on each line one at a time like so (this example is contrived, as it is ...

PHP and mysql question

hello everyone i'm having some problem ... question is i want to get the information from a form and save it in database the data is (comment, uploading pictures and email) when i did it it gave a warning the code // move file from temp location on server to your uploads folder move_uploaded_file($F1["tmp_name"], "Uploads/$F1[name]"...

Problem in using UPDATE command in PHP.

I am have some problem in updating my qotwVote1a table's Vote1a field through PHP. Could you please have a look at the code, and tell me what am i doing wrong in here. $result = mysql_query("SELECT * FROM qotwVote1a WHERE QuestionId='".$questionId."' AND MemberId='".$id."'"); while($row = mysql_fetch_array($result)) { $or...

PHP Sorting

I am trying to sort an associative array which has multiple vales per entry. For example [0] => stdClass Object ( [type] => node [sid] => 158 [score] => 0.059600525242489 ) [1] => stdClass Object ( [type] => node [sid] => 247 [score] => 0.059600525242489 ) I want the array sorted by 'score' (highest score is first index) How would I...

Have you ever had a client express concern over the services you provide simply because you use PHP?

We've been toying around with the idea that some of the reason we're not getting a higher caliber of client is because we've made it known that one of our primary partnerships is with an open source application vendor that provides a product built on PHP. Some clients we've talked to that don't even have the budget for "enterprise langua...

Captcha Breaking my Form?

I have implemented a captcha in my form, but it doesn't seem to be validating. I have included code below to see if there is anything obvious in my layout and how I can go about modifying it. Public and private keys have been deleted for the post. Thanks. <h1>Contact</h1> <form action="index.php" method="post"> <input type="hidden" nam...

finding extension of the file being uploaded using php

I am using PHP for a website. I have to get users upload their pics. Now, the pics can be in jpeg or png or gif format. My problem is that i identify a user by a unique userid, so I want to save the pics as: userid.jpg or userid.png etc. Now, how do i find out the extension of the file selected by the user using php? ...

How do I parse XML containing custom namespaces using SimpleXML?

I'm wondering how to parse values in XML that appear to have : in their name. I've been using: $response = file_get_contents($url); $data = simplexml_load_string($response); then doing a: foreach($data->item as $key => $current){ However, one of the latest feeds that I've been given has colons in the name of the feed as seen in ...