php

Zend_Db_Select: regrouping conditions in where clause

Hi, I would like to do something like this: $select = $myTbl->select() ->from('download_log') ->joinLeft(...... etc........ ->joinLeft(...... etc........ ->joinLeft(...... etc........); //Filter all configured bots (Google, Yahoo, etc.) if(isset($this->_config->statistics->bots)){ $bots = explode(',',$this->_config->statistics->bots)...

Value 10 gets reset to 1

I have this problem, I store a number in a database field. After a while I check if a value exist and if it does I take the number and add 1 this works fine up until 10, when I add a number to 10 it gets reset to 2 as if the zero is not counted for. $row = pg_fetch_array($result,0); $count = (int)$row[1]['count']; $count++; Table ...

How to pass a string containing both single and double quotes as a parameter to XSLT in PHP?

Hi, I have a simple PHP-based XSLT trasform code that looks like that: $xsl = new XSLTProcessor(); $xsl->registerPHPFunctions(); $xsl->setParameter("","searchterms", $searchterms); $xsl->importStylesheet($xslDoc); echo $xsl->transformToXML($doc); The code passes the variable $searchterms, which contains a string, as a parameter to th...

Using str_replace with smarty variable

Hello, Basically I just want to strip out a part of my smarty variable contents. {foreach from=$_sequences key=k item=v} {if $v.pri == $smarty.get.cf && $v.type == 'TTS'} {$v.data} {/if} {/foreach} {$v.data} will echo out 21,5555555555 I want it to only echo out 5555555555. I tried str_replace but couldn't get it working.. str_...

Known problems with filemtime() on Windows - files getting touched arbitrarily?

Is there a known issue leading to file modification times of cache files on Windows XP SP 3 getting arbitrarily updated, but without any actual change? Is there some service on a standard Windows XP - Backup, Sync, Versioning, Virus scanner - known to touch files? They all have a .txt extension. If there isn't, forget it. Then I'm gett...

Improve my Zend Stored Procedure calling code.

Hi, I'm wondering how i can improve my Zend code that calls a stored procedure. At the moment i'm using a MySQL DB, and the action function in my controller below works, but it seems nasty. public function callSPAction() { $param = $this->_request->getParam('param', 0); $bootstrap = $this->getInvokeArg('bootstrap'); $confi...

Can I redirect to a PHP page from a Perl CGI script?

I am working with a site that uses an outside source to work with payment transactions, one of the prerequisites is that on success a CGI script is called. What I am wanting to know is it possible to do a redirect to a PHP page with the CGI script and have the PHP detect that it has been loaded via a Perl redirect, I currently have this...

how to maintain checkbox status in pagination in php

i ve used pagination. what the problem is for example: i ve 3 pages 1) in the first i'm clicking some checkboxes and 2) i move on to the second and 3) return back to the 1st page the checkbox that i already checked is unchecked. for form submission i need the checkbox status that i ve checked on all pages should be submit. i need a detai...

php: problems with embedded apex in a string ?

how can I write more embedded " and ' in php ? For example, I dunno how to write this html complete element with all apex: As you can see, I use '' for the php string. Then inside, I use "", but then I need another level of apix and I dunno how to write that one in my php document. (php thinks that the string is complete in the middle b...

phpDocumentor alternative consuming less memory

Okay, I'm fed up with phpDocumentator. It consumes way much more memory (1.4 GB) and time (5 minutes on 2.6GHz Core 2 Duo) than I'm willing to give it. Does there exist some really compatible program to generate documentation for PHP code? I've tried PHPDoctor, which looks nice, but it has some missing features. However it is probably c...

How to do authentication using SOAP ?

How do i authenicate users with SOAP ? Will i have the user require to send his username/pass with every SOAP request and i authenticate him against the database ? Doesn't that seem to cause unnecessary queries ? ...

PHP OOP Concepts (Value Objects / Data Access Objects)

Hi, I've just started to learn PHP OOP, previously I have been doing PHP in a procedural manner. I was reading this article and I've got a couple of quick questions, How is the constructor for value objects commonly defined? As one that takes in all "data members" as parameters or stick to the default constructor and use mutator / acc...

PHP - Short hand if statement with a date format with weird output.

I am using a short hand notation of an if statement to format a field. If the field is an empty string I leave it as an empty string, if not then I am trying to format it to a proper datetime format so it can be inserted into a mysql db. here is my php code $date = ($date == '') ? date("Y-m-d", strtotime($date)) : $date; for some reas...

Redirected site files for desktop downloader

Hi, i temporarily change place for static files on site. But this files must have access from old URL, i've create a script that make's redirect to the right place, but this files are downloading by third-part program. The problem is that program ignoring redirect. I tryed to use permanent redirecting but no success. ...

Best place to store large amounts of session data

I'm building an application that needs to store and re-use large amounts of data per session. So for example, the user selects a large list of list items (say 2000 or significantly more) which have a numeric value as their key then they save that selection and go off to another page, do something else and then come back to the original ...

Is there something like the PHP function nl2br() for ASP.NET MVC?

Is there stock standard function that does newline to <br /> encoding in ASP.Net MVC? ...

A RecursiveParentChildIterator -- like the RecursiveDirectoryIterator

There are tons of examples of using the RecursiveIterator to flatten a tree structure.. but what about using it to explode a tree structure? Is there an elegant way to use this, or some other SPL library to recursively build a tree (read: turn a flat array into array of arbitrary depth) given a table like this: SELECT id, parent_id, na...

pass variable by reference within class? in php

I'm working on a hex color class where you can change the color values of any hex code color. In my example, I haven't finished the hex math, but it's not completely relevant to what I'm explaining here. Naively, I wanted to start to do something that I don't think can be done. I wanted to pass object properties in a method call. Is th...

PHP SOAP problems with response

Hello everybody, since a few days I am experiencing problems with my developed php soap (php soap extension, NOT nusoap) search interface to the PubMed literature service using their eutils wsdl service (Entrez Utils). Before the problems arised I used the returned array from the low level function __soapcall(), it worked well, extrac...

write image file larger than 4096

Hi, *************EDIT********** i am using ODBC and found that can not read more than 4096 for a field Any suggestions *************EDIT************ i am reading an image from db $image=$row["image-contents"]; Now try to write the file to disk $image_name="test.jpg"; $file = fopen( "images/".$image_name, "w" ); fwrite( $file, $i...