php

How do I search for and replace a specific area of content in a HTML document using preg_replace

I have a HTML document with the a table which I want to replace, however I don't know what the content of the table will be so I need to search for the opening and closing table tags and then replace the content between them. I'm a bit of a n00b with regular expressions so I'm having trouble working out how to do this... any ideas? Upda...

wamp with php5.3.3 ?

http://www.php.net/archive/2010.php#id2010-07-22-2 i want to test it on windows but it seems there isnt a fast wamp server that fits 5.3.3 are there any today ? thanks ...

If mysql_num_rows equals to ZERO is NOT working!

Hello guys I'm stucked at this point. So I need your help, thanks anyway. I'm using this code to count rows and trying to do IF num rows equals to ZERO do INSERT if not UPDATE but doesnt works. When I use "==" operator nothing happens, if I use ">=" operator script inserting the values but running insert query on every refresh and value...

Agavi exception on otherwise working master template?

I am using Agavi with Doctrine. The master template fails to load at times with a AgaviParseException listing out all instance of  . I'm using the latest stable versions of all technologies. ...

Can I declare that a php function throws an exception?

Can I declare a function in php that throws an exception? For example: public function read($b, $off, $len) throws IOException ...

How do I implement Facebook Connect alongside OpenID on my website?

Right now I have a website that only accepts OpenIDs. Each user's account is associated with an OpenID identifier. How would I allow users to use Facebook Connect to login? Are there any free, open-source client authentication libraries that abstract away the task of dealing with multiple services? I'm not looking for a service like RPX...

How do you separate visitors to two intro pages to compare amt of registration per visitor?

Hi. I am making a site that depend on users to register to be able to play my online game. If they don't login they only get to see the intro page. If the user login to the site I will save this information to the cookie so next time they visit they will be sent directly to the login.php. If the user don't have this information in the c...

PHP Increase Indentation of DOMDocument->saveXML ?

Hey, I need to increase indentation of a formatted xml file to 4 spaces from 2 I tried using a regex powered XML formatter but it forgot to indent closing tags that were on a new line. What options do I have, using preg_replace seems the best option, the search regex would be something like /( {2}^ANYTHING_EXCEPT_SPACE)/ but that's as...

Passing an array of data into a function (model). Please help!

Hello! I am using Codeigniter to pass an array of data from a controller into a model for insertion into the database. The code in the controller looks like this: $result = $this->items_model->add( array( 'ite_owner' => $this->post('user'), 'ite_type' => $this->post('type'), 'ite_value_1' => $this->post('va...

Zend Framework: Setup Autoloader to find namespace from specific directory

how do i setup the autoloader to find all classes in the namespace 'Entities' and 'Proxies' in APPLICATION_PATH . '/Entities' and 'APPLICATION_PATH . '/Proxies'' respectively. UPDATE i managed to make it work putting \Entities and \Proxies in \library\Application and add autoloaderNamespaces[] = Application in application.ini. but wha...

php array bitwise

if I have an array of flags and I want to combine them with a bitwise conjunction ie: $foo = array(flag1, flag2); into $bar = flag1 | flag2; Does PHP have any good functions that will do this nicely for me already? ...

PHP shift right

hey there i am trying to implement DataOutputStream in php (DataOutputStream from java language) in java code they shift right variables like this >>> in php i can only shift like this >> how can i do this in php ? thank you ...

What could change the directory in php Windows besides chdir() and chroot()? (Simpletest include file bug in Windows)

(Sorry if this is titled poorly. I'm actually trying to accomplish two things - find out how the current directory can get changed in PHP, and fix a bug in Simpletest running on WAMP.) I'm running SimpleTest (simpletest.org) on my Windows 7 local machine on EasyPHP (a WAMP variation). When I run tests, the directory changes from the l...

Set and Retrieve cookie trouble in PHP

I have a three pieces of code that are giving me trouble. This one sets the cookie setcookie("verify", "$value", time()+3600); This one is on a different page, it makes sure the cookie has the correct value if ( $_COOKIE["verify"] != file("name.txt")) { header("location: notset.html"); } else { die; } And this one deletes the ...

Doctrine : Hydrate doctrine collection with another model than the FROM clause

Hello, On my application, i frequently do doctrine query like this : $coms = Doctrine_Core::getTable('Comment') ->createQuery('c') ->join('c.article a') ->join('a.Writter w') ->where('w.something = ?', $something); I want to extract the comments from articles with a condition on the writter. Le query start from the Comment Table (...

JQuery Ajax bring in responses as they are created

I'm sending a post request to a php file that makes an MySQL query and iterates through the responses. During the iteration it echo's out a string that I want to bring into jquery one-by-one for each iteration. So for each echo I would like one success value so that the user does not have to wait for all the iterations to finish. The...

Redirecting to another PHP page, then going back with filled fields

I have been needing a way to, once I redirect to a PHP page to review data, have the ability go back to the original page with the fields filled as they were before redirecting. I can think of several messy ways of doing this but nothing I am willing to do. Is there a standard way of doing this? ...

writting files to a different directory

Possible Duplicate: PHP write outside document root assume i have a script in somewhere in the htdocs directory and i want this script to write files in a directory that is of the same parent as htdocs. how do i do it? ...

PHP: Having trouble uploading large files

I am doing a file upload using PHP, which works fine for a file of size 2.8MB on my localhost - but not my Mediatemple GS host. Files smaller than 2MB work fine, but anything larger seems to not work... I am not getting any error message but when the upload finishes, the file is not found in the uploads directory... I googled around, an...

Simple HTML Dom Parser, More Woes

Hello all, I am making use of the PHP Simple HTML DOM Parser to get the number 3869 from a HTML page. I tried this and a few other variations. foreach($html->find('span[class=searchresults_tab_number]') as $element) { echo $element->innertext . '<br />'; } But I keep getting nothing returned! All I need is the number from...