php

Delete an (exact) element from an array in php

Hi Masters! For example i have an array like this: $test= array("0" => "412", "1" => "2"); I would like to delete the element if its = 2 $delete=2; for($j=0;$j<$dbj;$j++) { if (in_array($delete, $test)) { unset($test[$j]); } } print_r($test); But with this, unfortunatelly the array will empty... How ...

Salesforce/PHP - outbound messages (SOAP) - memory limit issue? DOMDocument::loadXML() Premature end of data in tag issue?

UPDATE: OK I figured it out, looks like fread has a filesize limitation, changed this to file_get_contents('php://input') , but now having SF give a java.net.SocketTimeoutException: Read timed out error and nothing on the PHP side. I have also added set_time_limit(0); to the PHP script which if I understand correctly execute the scri...

help finding a hosing company with unixODBC and FreeTDS support

I need to find a hosting company that provides a LAMP stack, the P being PHP. Finding that is pretty easy, but I have a further requirement of unixODBC and FreeTDS or some equilant. The project will require a remote connection to a Microsoft SQL 2005 database. Most of the project will use a local MySQL database but it also requires d...

How should I architect JasperReports with a PHP front+backend system

Our system is written completely in PHP. For various business reasons (which are a given) I need to build the reports of the system using JasperReports. What architecture should I use? Should I put the Jasper as a stand alone server (if possible) and let the php query against it, should I have it generate the reports with a cron, and the...

PHPUnit: force display of asserted values

When in PHPUnit test fails, actual and expected values are displayed. But when the test passes, this information is not displayed. How to force PHPUnit to always display expected and actual assertion result? ...

Session in Iframe working in Firefox but not in Internet Explorer

Im trying to get a form working in Internet Explorer. I see that when i submit this form in Firefox I can start a session and send my webbrowser to the right page based on that Session. In Internet Explorer however when i'm debugging the $_SESSION i retrieve an empty array back, this means that in Internet Explorer the session isn't star...

What is wrong with this mail header text?

The following $header is being sent via PHP's mail($to,$subject,$content,$header) command. The mail arrives and appears to have an attachment. But the mail text is empty as is the file. I think this has something to do with line spacing but I can't see the problem. I have tried putting the contents (between the boundaries) in $contents ...

How to use less memory while running a task in Symfony 1.4?

I'm using Symfony 1.4 and Doctrine. So far I had no problem running tasks with Symfony. But now that I have to import a pretty big amount of data and save them in the database, I get the infamous "Fatal Error: Allowed memory size of XXXX bytes exhausted" During this import I'm only creating new objects, setting a few fields and...

Parsing XML with the PHP XMLReader

Hi Guys, I am writing program that reads in some XML from the $_POST variable and then parses using the PHP XMLReader and the data extracted input into a database. I am using the XMLReader as the XML supplied will more than likely be too big to place into memory. However I am having some issues, my XML and basic code as are follows: ...

Proper way of setting up database for ease of use?

So i'm trying to figure out the smartest way to do this. I have a list of businesses that can have photos and videos. i've created tables for: business, photos, videos. I also created a table for specials. I want to have featured businesses on the front page. Should I create a table called featured and have the businesses id stored in th...

Trying to login to site with PHP & cURL?

I've never done something like this before...I'm trying to log into swagbucks.com and get retrieve some information, but it's not working. Can someone tell me what's wrong with my script? <?php $pages = array('home' => 'http://swagbucks.com/?cmd=home', 'login' => 'http://swagbucks.com/?cmd=sb-login&amp;from=/?cmd=home', ...

Display sql results in groups

Hi all, I have an sql query here and it returns a number of results. I'd like to show these results in groups. What I mean is, show the first 20 results in some part of the page, show the next 20 results in another part of the page etc... How can I do that? *I'm using PHP to display results. ...

PHP : How to get specific data from array

Hello! I try to use amazon API using PHP. If I use print_r($parsed_xml->Items->Item->ItemAttributes) it show me some result like SimpleXMLElement Object ( [Binding] => Electronics [Brand] => Canon [DisplaySize] => 2.5 [EAN] => 0013803113662 ** [Feature] => Array ( [0] => High-powered 20x wide-angle optical zoom with Optical Ima...

Create a nested list

How would I create a nested list, I currently have this public function getNav($cat,$subcat){ //gets all sub categories for a specific category if(!$this->checkValue($cat)) return false; //checks data $query = false; if($cat=='NULL'){ $sql = "SELECT itemID, title, parent, url, description, image ...

searching between dates in MYSQL in this format 03/17/10.11:22:45

I have a script that automatically populates a mysql database with data every hour. It populates the date field like 03/17/10.12:34:11 and so on. I'm working on pulling data based on 1 day at a time from a search script. If i use SELECT * FROM call_logs WHERE call_initiated between '03/17/10.12:00:00' and '03/17/10.13:00:00' i...

modify array in loop

Here is the code: $arraya = array('a','b','c'); foreach($arraya as $key=>$value) { if($value == 'b') { $arraya[] = 'd'; //print_r($arraya); //$arraya now becomes array('a','b','c','d') } echo $key.' is '.$value."\n"; } and it will get: 0 is a 1 is b 2 is c And I wonder why 3 is d doesn't show up??...

How do I supply a variable to put in a another variable in PHP?

I'm not sure if I asked the question correctly. I have some code I am trying to embed. For instance: $menuPopup ='<IMG SRC="' . $someVariable . '">'; Later on, I have the a few product variables: $someProduct1 ='image1.jpg'; $someProduct2 ='image2.jpg'; Later on, want to display the $menuPopup, using a src from $someProduct1, or $...

need to display info for user within active-directory

The following code will search for the user within the domain controller, but I want to display the info of each thing noted within the justthese variable: "displayname","mail","samaccountname","sn","givenname","department","telephonenumber" $dn = "dc=xxx,dc=xxx"; $justthese = array("displayname","mail","samaccountname","sn","givenname"...

Doctrine: Select elements that are related to one or more items in many-to-many relation

I have a category system that is related many-to-many with posts. How can I select a list of those categories that are related to one or more posts? $q = Doctrine_Query::create() ->from('Category c') ->where('<DONT KNOW WHAT TO WRITE>') ->select('c.name'); ...

PHP Error: Warning: session_start() [function.session-start]: Node no longer exists

Getting the following error when trying to start a session: Warning: session_start() [function.session-start]: Node no longer exists in file.php on line 3 The script uses SimpleXML to parse XML files from remote hosts. It's running on a Linux Ubuntu server with PHP 5.2.6. Has anyone come across this message before or have an insight i...