php

How to check whether a non-assoc array is unique in PHP?

I want to know whether the array $arr has duplicate elements. ...

Assigning xml generated by a while loop to a variable

Hi guys, I am creating XML using a while loop, but now I need to prepend and append the generated XML with the XML header info and wrapper tag, but I am struggling to get it to work, here is my code, $result = mysql_query("SELECT * FROM users") or die(mysql_error()); $row = mysql_fetch_array($result); while ($row = mysql_fetch_arr...

Multi user - Drag&Drop

Hi! I have a tree ful with data that are draggable (& droppable). It all works fine, but there's one problem. When more users're working on this module (with tree) and they're dragging objects around, all get mixed up. So I'm working on a solution, but I got as far as table lock in mysql. But if I do that, just one user can work on thi...

[PHP] Is there a way to redirect to an error page in register_shutdown_function ?

Hi all, I'm trying to find a clean way to handle fatal and critical errors (i.e. without output buffering), and I read that using HTTP headers in register_shutdown_function is impossible. The thing is, I'd like to redirect to a generic static error page when a critical error occurred (e.g.: service unavailable). How should I do ? D...

Dont want to show address in the status bar while hovering a link

How can I prevent showing web address at the status bar while hovering a hyperlink? ...

Tagging phrases in paragragh

I am using PHP and I am looking to create links within my text to other sections of the site so for example: I fell into the media industry aged 30, when David Mansfield, now on the board of Ingenious Media, gave me my first break at Thames TV. From there, I worked at the (now-defunct) Sunday Correspondent and IPC, before joining TDI, w...

copy textfield value from one tabs to another tabs

hi all..i'm using jquery tabs.. i'm use tabs-1 as input form and tabs-2 as show input data... i want after submit..all value inside textfield which have been type at tabs-1 can copy into textfield at tabs-2... where part that i must modify?at form or at process page?what's code that can make it works? <script type="text/javascript"> ...

PDO positional and named parameters as part of the same prepared query?

I'm learning the ropes with PDO. Here is my sql (the number of parameters that can appear in the WHERE is variable). SELECT ID, title FROM table WHERE something = ? ORDER BY :sort :dir LIMIT :start, :results Here is my code: $query = $conn->prepare($sql); ...

Setting a variable in a class function, where can I use that variable

Hi all, If I have a class (like below) and in a function I set a variable (below:$this->example) but I havent declared the variable at the top of the class (e.g var $example;) where and how can I use this variable? I tried using it straight away in another function but it didn't work (I guess I could have made a mistake but it worked a...

Calculate number of hours between 2 dates in PHP

How do I calculate the difference between two dates in hours? For example: day1=2006-04-12 12:30:00 day2=2006-04-14 11:30:00 In this case the result should be 47 hours. ...

Changing the module that updates the currency rates in Prestashop

I am currently working on a Prestashop site. I included a new currency and then clicked on Update Currency Rate only for the system to set my new rate equal to the default currency rate. Is it possible to change the default currency converter that Prestashop is using to something that could accommodate my own currency ...

validate a multi select input field in html using php and javascript

Hai I have a select input field in multiple properties. I have to validate( empty check) this field in both JavaScript and php .My code is like "select multiple="multiple" name="frm_supply[]>" Does any one help me? ...

authorization before adding facebook application

hello guys, i have a problem here, i m new to facebook application.. i have created facebook application iframe and with php, my problem is when a new person goes to the application canvas, it doesnt ask for authorization, i m tired of googgling, i want it like new user visits my applications canvas, it should ask for authorization that ...

iterating SimpleXml xpath result

I'm using SimpleXMLElement to read xml returned from a remote server. The results are then parsed with xpath like this: $result = <<<XML <DataImport2Result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.xxx.xxx/Services/DataImport2"&gt; <Number /> <Blocks> ...

Programmatically add Bundle Products in Magento, using the SKU / ID of Simple Items

I have some simple catalog products in Magento, so I have their SKUs & IDs. Now I want to create a Bundled product using the array elements "bundle_options" & "bundle_selections" of the Bundle Items, which are used by the Magento Admin coding in its Observer Class. Also in the Observer class, there are method calls of two functions "...

Codeigniter: watermarking images and saving the result in database

Hello all, I am trying to upload an image, put another image over it (like watermark) and save the result in the database, all using Codeigniters image_lib class. Here's the code: if ($_FILES['userfile']['error'] == 0 && $_FILES['userfile']['size'] > 0) { $uploaddir = "media/"; $fileName = $_FILES['userfile']['name']; ...

how to run php test case with selenium rc in linux

Hi, For Server Side We have copied the selenium core in the apache htdocs directory. Also our AUT is also on the same machine The machine IP address on LAN is 10.0.2.6 For Client Side We are running "java -jar selenium-server.jar" Executing the PHP file generate from Selenium IDE Test case as "php ad1_php.php" which is attached ...

If there isn't something like this in Drupal then it should be added: translating object properties

Digging into the api looking for methods to translate a property of a category term I could only find methods that take a string as the param, but what happens when I have the id of the object which property I want to translate? I'd like to be able to just pass this id and get the translated string (if exists). I achieved this with a rel...

How to match a block of <li></li> using regexp

Hi guys, how can I match a block of <li>item 1</li> <li>item 2</li> no matter there is a blank line before or after the block and enclose it in <ul></ul> tags using PHP's preg_* functions. Thank you for answer ...

how to run and install phpize

Hi there, I have been meaning to install ffmpeg as an extension to my php setup. So before I can install it, I need to phpize it. I installed php5-dev by sudo apt-get install php5-dev But now when I run phpize I get the following error : phpize Cannot find config.m4. Make sure that you run '/usr/bin/phpize' in the top level source di...