php

catching multiselect values in select box

Hi, can anyonme give me an idea of how to catch (using PHP) multiple values from a multi 'selectbox' please? <select name="auto_issue_update" multiple> <option>1</option> <option>2</option> </select> ...

explode glitch in delimiter

I'm having some trouble with delimiter for explode. I have a rather chunky string as a delimiter, and it seems it breaks down when I add another letter (start of a word), but it doesn't get fixed when I remove first letter, which would indicate it isn't about lenght. To wit, the (working) code is: $boom = htmlspecialchars("<td width=25...

How to plot a realtime graph (histogram) using data obtained in a text file

I have a continuously generated data (text file) generated by a program on the server. I want to plot the data as a real-time graph just like powergrid does. This was my approach: As the data is generated continuously on the server in a text file, I wrote a PHP script which reads that file(get_file_contents), outputs the data points an...

PHP SimpleXML XPath contains() to find other elements referenced by this element

Hi Guys ang Gals, I'm being given XML in the following format, and am parsing it with PHP's SimpleXML. <?xml version="1.0" encoding="UTF-8"?> <ManageMyBooking> <BookingInfo> <PartyDetails> <Passenger> <PaxNo>1</PaxNo> <Title>Mrs</Title> <Surname>Murphy</Surname> ...

Checking for document duplicates and similar documents in a document management application

Update: I have now written a PHP extension called php_ssdeep for the ssdeep C API to facilitate fuzzy hashing and hash comparisons in PHP natively. More information can be found over at my blog. I hope this is helpful to people. I am involved in writing a custom document management application in PHP on a Linux box that will store vario...

Dreamweaver Regex Help

Hi i am trying to do a find and replace on files for this <?php include $_SERVER["DOCUMENT_ROOT"]."/articles/[^a-z]/footer.php"; ?> to <?php include $_SERVER["DOCUMENT_ROOT"]."/includes/class/footer.php"; ?> but for some reason it is not working! i have a clue that its the / messing it up? Cheers ...

Zend Framework: How can I tap into the final view output before it's sent to the browser?

Hi there, I'm trying to access the final xhtml output right before it's sent to the browser as a string. The postDispatch() methods of the actions and plugins seem to be too early to do this. When I step through Zend_Controller_Front::dispatch() method using a debugger, I can access the desired output as a string right before $this->_re...

CakePHP and connecting to MS Access db using Unixodbc

I'm trying to use an Acces (MDB) database from a CakePHP app. On a Windows machine this works fine. On a Linux machine using Unixodbc this doesn't work at all. The error is as follows: Warning (2): odbc_connect() [function.odbc-connect]: SQL error: [unixODBC][Driver anager]Data ource name not found, and no default driver specified, SQL ...

unit test a method that creates an object

I'm trying to get my head round Unit Testing and there's one more piece of the jigsaw I need to find. What I'm trying to do is write tests for the following code. In this case, I've got a really simple Front Controller (written in PHP). class frontController { public function routeRequest($oRequest) { $sClassname = $oReques...

how expensive is this php downcasting workaround

This question is related to http://stackoverflow.com/questions/1721949/downcasting-in-php5 How expensive is this php downcasting workaround? Is this php downcasting workaround too expensive? I've echoed microtimes and It seems that it takes like 0.001. I wonder if It could be a problem in a large foreach. public static function to(...

How to change table background depending on database textareas 'height' ?

Is it possible to get the height of a 'text' field from mysql? Or the number of linebreaks would also work! I have a table which fetches the 'text' field from my mysql database. The background image of the table is sort of a container... I want the background to change to another (taller) background if the text is vertically high! Poss...

Logging all Soap request and responses in PHP

Does anyone know how to log all request and responses with the builtin SoapClient in PHP? I could in fact manually log everything with SoapClient::__getLastRequest() and SoapClient::__getLastResponse() But we have that much soap requests in our system that i'm looking other possibilities. Note: i'm using wsdl mode so using a method that...

mySQL - Apply a row level lock using mysqli

Using PHP's mysqli how do you apply a row level lock? Row level locks stop anyone editing currently present rows that match your criteria right? but do they stop a user inserting a row which matches your criteria? Thanks ...

PHP Preg-Replace more than one underscore

How do I, using preg_replace, replace more than one underscore with just one underscore? ...

Php syntax error

Hello, here is my error: Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home3/*/www/modules/mysql_worker.php on line 9 Here is file mysql_worker.php http://pastie.org/697284 ...

How does PHP process functions in a file?

Say I have file.php with three functions and an echo statement: function one() { return three() . ' This is one.'; } function two() { return 'This is two.'; } function three() { return 'This is three.'; } echo one(); // string(xx) "This is three. This is one." First, is it generally acceptable to have function one() cal...

Require a method in parent class to be called in PHP

As the title states, I'm trying to make a method in a parent class required. Although, I suppose it could be any class. For instance: class Parent { funtion foo () { // do stuff } } class Child extends Parent { function bar () { // do stuff after foo() has ran ...

What is the best solution for creating a SOAP Server in PHP?

I need some advice on which library is the best choice when it comes to creating SOAP servers (and eventually SOAP clients) in PHP. I know there is built-in functions for this, but is that really the best way to go about it? Also, if you could attach some arguments as to why a certain library/method is the better, i'd be much delighted...

PHP file writing optimization

EDIT: Optimization results at end of this question! hi, i have a following code to first scan files in a specific folder and then read every file line by line and after numerous "if...else if" write new modified file to another folder with the name name as it was when opened. The problem is that writing a file line by line seems to be ...

Regular expression HTML tags in an array

I've split a large body of XHTML into individual array elements, and I now need to iterate through them and split it at regular intervals. That's not a problem, but I want to ensure I don't split it in the middle of an XHTML tag. So the array looks like: [41] => <p> [42] => materials [43] => and [44] => dosage [45] => forms:</p> [46] =>...