php

Regex to automate some html tagging

Hi, I'm having 800 entries that are very similar, but they need some stuff done to them. The format is like this: <td class="description"> Describing text. Might very well be 2 paragraphs </td> I need to do some stuff to the text inside the cell. I've tried to use preg_replace('/(.+)<\/td>/'). It ends up with two problems. ...

Why Zend_Form produce <dt id="label-id"> <dd id="elem-id"> ?

Hi, Why Zend_Form produce <dl> <dt id="label-id"> <dd id="elem-id"> </dl> ? (I understand that its produce by default decorators, but why and for what they used? ) Thanks ...

Variable in IF [PHP]

if ( $a > $b) { $c = $a-$b; } echo $c; PHP Notice: Undefined variable... why? ...

How to create the $key value for mcrypt_decrypt?

Hi, I'm trying to decrypt a string using mcrypt_decrypt, but I'm not sure how to get the key into a 'string' type: $key = array(-2, -2, -2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2); pkcs5_unpad(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $text, MCRYPT_MODE_CBC, $iv)); the key was generated using a random key generator, I used it on the e...

getdate() in mysql

I am creating a system which updates the user activity when something is done. I have a variable $userhistory= 'User edited '.$info.' on July 14 2010 or (07-14-2010); I want to know how can i get the date automatically. for sql query i am using NOW(), but in a variable like $userhistory how do i get the date and it want it only in eithe...

Are there any php frameworks contain small webserver and rich console tools like RoR/Django?

In Ruby on Rails, I can start my web application, just write in console: script/server. RoR contains small webserver and rich console tools, but I didn`t meet such tools in php frameworks. Are there any php frameworks contain small webserver and rich console tools? ...

Regular expression for end of line phrase

Hi, I am grabbing a block of text, within this block there will be a line containing a phrase that ends "WITH PASSWORD kEqHqPUd" where kEqHqPUd is a dynamically generated password. Can anyone provide a simple regex for grabbing just the password within this. FWIW i'm using PHP. Thanks ...

Fetching latest 5 blog articles from our blog

hi all...... i want to fetch 5 latest blog articles on my new website from my blogs which is on another website ............ iam using php mvc framwork on my new website........... plz help me with the any example code snippets................ thanks in advance............ ...

Asynchronous cross-domain GET requests

Does anyone has any solutions on accomplishing asynchronous cross-domain GET requests. I am looking to make a site that checks available names of other sites. The faster the better. I'd like it to use my server if possible, as its most likely faster than the client. Would most likely send it a huge array (300-10000) requests. Examples,...

PHP: how to handle 2 headers in sequence

hi, can I call two consecutive headers in my php code ? header("Location: http://" . $_SERVER["HTTP_HOST"] . "/$file"); //download file (http get) header("Location: http://" . $_SERVER["HTTP_HOST"] . "/$page"); //redirect to page The first header function redirect to a url to download a file, while the second header forwards the cust...

Return in eval function for Php

Hello, I need to pass a return $variable; within the eval function, which in turn is going to return a value for a function. Here is an example: function something() { $sSomeVar = 'something'; eval( 'return $sSomeVar = 3;' ); } The code above will return 3 for the eval, but the function will not return the value for the variabl...

is there a way to view past mysql queries with phpmyadmin?

i'm trying to track down a bug that's deleting rows in a mysql table. for the life of me i can't track it down in my php code, so i'd like to work backwards by finding the actual mysql query that's removing the rows. i logged in to phpmyadmin, but can't find a way to view the history of past sql operations. is there a way to view t...

Redirect visitor and create new referrer info? (some PHP)

I have 2 websites -- website A is the primary 'marketing' site that receives traffic and website B is the site where people make a purchase. Site B's reporting system provides me with the referring URL from site A that resulted in a purchase. Site A has a variety of call to action links that go to site B, and I would like to measure wh...

write php code to mysql?

Is there any possibility to write php code to mysql and then use it in php, in order to process the output, not just write it? I would like to use mysql, instead of included file...if it is possible. ...

Zend Framework and Couch DB

Hi there! Does Zend Framework has native Couch DB support? I found only Zend_Couch by Matthew Weier O'Phinney. http://framework.zend.com/wiki/display/ZFPROP/Zend_Couch+-+Matthew+Weier+O'Phinney Thank you. ...

Quick and dirty way to make forms for editing fields in MySQL databases

Hi, I have a seriously ridiculous deadline to meet because I'm picking up from a disgruntled developer. I have a database with a few tables and some one-to-one mappings, nothing too complicated. I need to create a backend for searching and editing these tables in some kind of HTML form style (not necessarily web-based if there is a bet...

PHPunit mockobject abstract and static method

Hi, I would like to test a method from an abstract class. In this class is there a abstract method with is static. I use PHPUnit. With normal abstract methods it works: <?php abstract class AbstractClass { public function concreteMethod() { return $this->abstractMethod(); } public abstract function abstractMethod(); } cl...

Facebook share description encoding weirdness

Hello There, On this link, the meta description from http://www.dontforgetanniversary.com has encoding problems with accents. I still have tho. I wonder where it could come from. ...

strange ob_start() behaviour - double output

Hey all, ob_start() doesn't seem to be stopping any output so when I flush the buffer it's doubling up <?php ob_start(); echo "Text..... <br />"; echo ob_get_flush(); ?> Outputs Text..... Text..... But I was expecting Text..... Any ideas ? Thanks ...

Test of file existence always fails

<? $user_image = '../images/users/' . $userid . 'a.jpg'; if (file_exists($user_image)) { echo '<img src="'.$user_image.'" alt="" />'; } else { echo '<img src="../images/users/small.jpg" alt="" />'; } ?> Hello all, this code is supposed to check for a file and if it doesnt work, display another. For some reason it is ALWAYS d...