php

Why overriding Doctrine_Record::save() give me a strict standard error in Symfony 1.2 ?

I have the following model : class Model extends BaseModel { public function save($conn = null) { if(!$this->getId()) { //do stuff } return parent::save($conn); } } I feel like I am follwing the API description of Doctrine_Record::save() signature (Except the weird parenthesis I would give me...

How to check if a xml value is null in Flex?

$output .="<keyword>".$_POST['keyword']."</keyword><name>".$row['url']."</name><occur>".$row['occurrences']."</occur><queryTime>".(substr($end_time-$start_time,0,5))."</queryTime>"; } I want to check in Flex, if the value of name is null or not. I tried for these, but i am not getting any alert when the node value is empty. event.resu...

MySQL parent -> child query

Hello, I'm working with mySQL, and I'm in a situation where I need to select data from one table that matches an ID at any level in parent -> child data hierarchy in the other table. Further more, I would like to resolve this with a well written SQL query, rather than a recursive function in my PHP code, as this feature will be used qu...

PHP mail() results in a "dead.letter" file

I have a script that uses PHP mail() function to send emails: mail("[email protected]", "Subject", "Message"); Everything worked fine until yesterday. Now the mails either end up in a dead.letter file or just don't get sent. What could be the reason for this? Any hints into how do I debug such code? ...

Conditon related PHP Question

$output = "<loginsuccess>"; for( $i = 1; $row = mysql_fetch_array($result); $i++ ) { $output .="<keyword>".$_POST['keyword']."</keyword><name>".$row['url']."</name><occur>".$row['occurrences']."</occur><queryTime>".(substr($end_time-$start_time,0,5))."</queryTime>"; } $output .= "</loginsuccess>"; I need now a simple condi...

Configure Easyphp to process htm files as php

Hi there. On my remote server I'm using the line AddType application/x-httpd-php .php .htm .html to parse the php in files with htm/html extensions How can I replicate this behaviour on my local machine running EasyPHP. I have tried adding the same line to Apache/conf/httpd.conf and restarting the server, but the files are displayed as h...

Definition of spaghetti php?

Hey, I've seen "spaghetti" thrown about a lot and I just want a clear explanation on what is spaghetti code and what isn't. Just because I'd rather not be doing it. References in PHP would help as that is my language of choice. ...

PHP Multiple Dropdown Box Form Submit To MySQL

Couldn't find any good information on how to do this so I thought I'd add it here. How do I grab the selected data from a multiple choice drop down html form using php and submit into a database. I need a seperate row for each choice. I'd be happy just knowing how to grab the data and put it into an array. ...

Can some explain what this script does please

class person { var $name; var $email; //Getters function get_name() { return $this->name; } function get_email() { return $this->email; } //Setters function set_name( $name ) { $this->name = $name; } function set_email( $email ) { if ( !eregi("^([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,...

Why is this regular expression match positive?

Given the pattern ^[a-zA-Z0-9 .\-_]+$ and the string te\\st, why is the match positive? I'm using this to validate usernames and I don't want people to put slashes in their usernames, it messes with URLs. I'm calling ereg($pattern, $username), running PHP version 5.2.8. ...

xml integration - post xml to a url.

please help me i am this question again dont block this question i want to post my xml file to a url from where i will get a reponse xml document in return but i dont know how to do this i want to do this as simple as possible without using curl or any other things just using java script , ajx and php please any one provide a co...

Implement PHP interface such that object instance can be passed as array type argument?

In PHP it is possible to specify argument types although they call it type hinting. I am implementing an interface where one of the functions specifies an array as the argument type: function myFunction(array $argument){ } I'd like to define a class, an instance of which can be used as the argument for this function. In other words i...

Displaying array data in horizontal manner using php and smarty

Suggest me a better way to do it. I would like to show the array result in the horizontal manner. Column1 | Column 2 | Column 3 3 | 7 | 10 now it shows in vertical manner as follows Column1 | Column 2 | Column 3 3 7 10 Array Result : Stored in $result variable and assigned in ...

Extract floating point numbers from a string in PHP

I would like to convert a string into floating numbers. For example 152.15 x 12.34 x 11mm into 152.15, 12.34 and 11 and store in an array such that $dim[0]=152.15, $dim[1]=12.34, $dim[2]=11. I would also need to handle things like 152.15x12.34x11 mm 152.15mmx12.34mm x 11mm Thank you. ...

php include: ms word generated html file and garbage css

word generated html sucks, of course. but i unfortunately need to fetch some text from such existing docs to my php pages. the problem is, then it messes up my original page's css. what could be a way out? thanks! ...

What is CMIString4096 and how can I extract the data within it?

I have this string that I get back from Adobe Presenter 7. It's called suspend_data and is of type CMIString4096 (by the docs) CMIString4096 A set of ASCII characters with a maximum length of 4096 characters. This is the string: aG1111111000000000BB001EC%2EacC%7E%24GS%2AayjHm110BKCBBB0B0EBAB1B1ED%2EicC%7E%24GS%2AlfkHm110BKDBC...

How to display HTML to the browser incrementally over a long period of time?

Do I need to pass back any HTTP headers to tell the browser that my server won't be immediately closing the connection and to display as the HTML is received? Is there anything necessary to get the HTML to incrementally display like flush()? This technique used to be used for things like chat, but I'm thinking about using it for a COMET...

How do I Programmatically Output Custom Paths for Drupal Node Links (w/o PathAuto)?

I would like to be able to programmatically change the outputted path to a Drupal node without using the PathAuto module. We currently process a large volume of content (thousands of articles per day) that get added on the back-end. Rather than use PathAuto to generate path aliases, I would like to have Drupal output the default link b...

ExtJS grab JSON result

Hello. I'm generating JSON response from PHP witch looks like this: { done:'1', options: [{ message:'Example message'},{message:'This is the 2nd example message'}]} I want to grab these results using ExtJS. This is what I have so far: Ext.Ajax.request({ loadMask: true, url: 'myfile.php', params: {id: "1"} }); What d...

Can PHP mysql and mysqli module connections to the same database be used side-by-side safely?

Say one were looking at transitioning a codebase from using the basic PHP mysql_* functions to a mysqli implementation. Can connections to the same database be used side-by-side in both interfaces, or is there some way in which they can interfere with one another? ...