php

My output is displayed more than once I want to display it once correcting the below given code

Please help me to rectify my code. Here I have described the code what and why I am using... and finally whatI am getting at the end, but the end output is not the way what I want... Please help and tell how I can rectify it... $count = substr_count($row4['ACTION_STATEMENT'], " IF (NEW.");/*here i will get how many time i will get " IF ...

php how to decect if wget faced 404 error?

Hello, I'm running wget through php's shell_exec() How could I understand that wget got 404 error getting file? Thank you. ...

To divide the big text into columns.

Problem: There is a big piece of the text: <div class="cont"> <p> Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam volupt...

Php string handling tricks

Hi my question Need to get the 10 word before and 10 words after for the given text . i mean need to start the 10 words before the keyword and end with 10 word after the key word. Given text : "Twenty-three" The main trick : content having some html tags etc .. tags need to keep that tag with this content only . need to display t...

Only replace first matching element using PHP's mb_ereg_replace

Hello, I want to replace only the first matching element in a string instead of replacing every matching element in a string $str = 'abc abc abc'; $find = 'abc'; $replace = 'def'; echo mb_ereg_replace( $find, $replace, $str ); This will return "def def def". What would I need to change in the $find or $replace parameter in order to ...

php object : get value of attribute by computed name

hi simple question - How do I access an attribute of an object by name, if i compute the name at runtime? Ie. i loop over keys and want to get each value of the attributes "field_".$key In python there is getattribute(myobject, attrname) It works, of course, with eval("$val=$myobject->".$myattr.";"); but IMO this is ugly!! TIA fl...

Generate a left hand menu for product categories in Magento

I'm looking for a method to generate a left hand menu in Magento much like the top menu present in the default template, anyone have a method for doing this? ...

calling a stored postgres function from php

I originally posted the question here: http://stackoverflow.com/questions/2536727/calling-a-stored-postgres-function-from-php I accepted the answer, but, it actually isn't working for me... Here's the original question: I have a function in postgres, and when I'm at the pg prompt, I just do: SELECT zp('zc',10,20,90); FETCH ALL FROM zc...

PHP: Escape illegal chars in .ini-files

The documentation on parse_ini_file states that you can't use these chars {}|&~![()^" in the value. Is there some way to escape these chars? I need to use them. Normal escaping with \ doesn't seem to work. ...

Fastcgi 500 error on preg_match_all in PHP

I'm trying to set up some exotic PHP code (I'm not an expert), and I get a FastCGI Error 500 on a PHP line containing 'preg_match_all'. When I comment out the line, the page is returned with a 200 (but not how it was meant to be). The code is parsing PHP, HTML and JavaScript content loaded from the database and is composing them to ret...

curl cookie not creating on success

Hi I'm using cUrl(PHP) to post a login request and store response in cookie file. In my second request I'm passing cookie in header and post data to verify it. Issue is that cookie file is not created in first succesful request results in failure for second request. Please suggest me where I'm doing wrong. $cookiefile="/var/www/html/di...

jquery ui autocomplete with database

I fairly new to JQuery and perhaps trying to achieve something that might be abit harder for a beginner. However I am trying to create an autocomplete that sends the current value to a PHP script and then returns the necessary values. Here is my Javascript code $("#login_name").autocomplete({ source: function(request, response) { ...

Character Encoding problem?

Hi, In my mysql database I have the following information in a page name field. ç,Ç,ö,Ö,ü,Ü,ı,İ,ş,Ş,ğ,Ğ If I do a phpmyadmin dump the above is exported. I am using a different php script and instead of the above I am getting this. "ç,Ç,ö,Ö,ü,Ü,ı,İ,ÅŸ,Åž,ÄŸ,Äž" This is the snippet which is generating the output. $da...

How to convert a PHP object to a string?

I get this error: Catchable fatal error: Object of class stdClass could not be converted to string So, my question is, how do I convert an object to a string in PHP? I don't want to serialize it though. Just a note: the code I use works in PHP 4, but not in PHP 5 Thanks! EDIT: I resolved it myself. It was a pain, but I did it. Than...

PHP Error, is it resolvable, or a language bug?

Given the following code $c= new SoapClient('http://www.webservicex.net/CurrencyConvertor.asmx?WSDL'); $usa = "USD"; $eng = "GBP"; doing a __getTypes on the client gives me Array ( [0] => struct ConversionRate { Currency FromCurrency; Currency ToCurrency; } [1] => string Currency [2] => struct ConversionRateResponse { double Conve...

php gzip xml file (53MB) casue Out of memory error

Hi, i have a 53 MB xml file that i want to gzip. The code below gzip it $gzFile = "my.gz"; $data = IMPLODE("", FILE($filename)); $gzdata = GZENCODE($data, 9); //open gz -- 'w9' is highest compression $fp = gzopen ($gzFile, 'w9'); //loop through array and write each line into the compr...

Facebook require_login() in iFrame App

Hi, I have serious problem with iframe application. I need to use many external JS libraries and other dynamic stuuf so FMBL application can't be done. When I call require_login() I get applicaition installing dialog when app is not already installed, which is ok. But then after authorization application enters an endless redirect loop ...

Is it possible to stream a file to and from servers without holding the data in ram?

Hi everyone! PHP question (new to PHP after 10 years of Perl, arrggghhh!). I have a 100mb file that I want to send to another server. I have managed to read the file in and "post" it without curl (cannot use curl for this app). Everything is working fine on smaller files. However, with the larger files, PHP complains about not being...

Export to word from php doesn't seem to work for me...

I exported data from php page to word document but the problem is the header is not available in all pages.... Header is present in the first page but not in the next pages of the word document..... Here is my code, function changeDetails() { $bType = $this->input->post('textvalue'); if ($bType == "word") { $this->...

How XAMPP 1.7.3 can support PHP 5.3 and PHP 5.2 and other lower PHP

Hi, I would like to know how to setup XAMPP Server with multiple PHP versions (eg PHP 5.3, 5.2, 5, and 4), I know WAMP can easily do this, But I have problem with a WP Plugin using WAMP. Now if XAMPP can support PHP version, It would make my life easy and organize; Compare to installing both WAMP and XAMPP (that I did last time, before ...