php

can I update a label using ajax, instead of a textbox?

Hi, I'm using ajax to update a textbox once the value in a drop down box has been selected. However, i only update/put text in it if certain conditions are met, so it looks rubbish when there is no message. I was thinking that having a label there would be much better, but is this possible? Can i have an empty label and just update the ...

Indexing an array every cycle (in seconds)

I have to put datas every 10 seconds in an array. Is it silly to index this array with modified timestamps $a[timestamp] = 54; $a[timestamp+10] = 34; or in Javascript with the setInterval() and passing via Ajax the index (very crappy to me) ? or have I a best option ? Further details : I have to link the real-time with entries in...

how to insert a image into Db as blob in ZendFramework.

I want to insert a image in blob format to db. how to write a program in zend framework. a simple form just choose one image and insert into db. ...

how to loop over looped elements?

I'm creating a tree-structure of categories with parentid's which can be called from children in such a way: ID | Name | ParentID 1 1 0 2 2 1 3 3 2 4 4 1 Resulting in this: 1 = 1 2 = 1 -> 2 3 = 1 -> 2 -> 3 4 = 1 -> 4 which means 3 is a child of 2, which is a child of 1. when trying to get this idea ...

PHP COM function returns struct gives Error [0x80070057] The parameter is incorrect.

I'm trying to call a function Size() from a custom COM DLL from PHP. That function should return a struct with 4 members (top, left, bottom, right) however when I call that function from PHP I get the following error: Error [0x80070057] The parameter is incorrect. I don't pass it any parameter and according to the specs it should...

How would I go about cropping an image automatically on the server?

Like at Digg.com, I want to get members' pictures cropped for an avatar use. Please show me how to do this in PHP. ...

php multilingual site

Is it possible to create a multilingual site only in php without mysql (database) a good resource will be nice to have please provide ...

ffmpeg + PHP + Zend Framework

Here's the situation. While uploading a video, I want to capture a screenshot of that video and save it as a video thumbnail. I currently can't install ffmpeg on my local machine (it will be installed on the production server of course) so I cannot test the following controller action helper I wrote for this purpose: <?php /** * FlvThu...

Am I doing Doctrine subclasses correctly? Why the Error?

I started to build a POS system in Doctrine. I am getting an order, but I have no clue whether or not I even set up subclasses in the proper way for Doctrine. Here is the model I came up with for line items on an order lineItem: line_total, order_id, type rentLineItem: returned_date_time, item_id, sold buyLineItem: item_id The databa...

SQL query result in a string (or variable)

Is it possible to output SQL query result in one string or variable? (i'm bad in php and mysql) Let's say I have db "agents" with columns - agent_id, agent_fname, agent_lname, agent_dept. Using this query: $sql = SELECT a.`agent_fname` FROM agents a WHERE a.`agent_dept` = 'FCA' I want to get a string or a variable, so I can use it in...

Cron error messages; is it my script causing the errors?

I have a cron job that ideally I want to run hourly (it's on the FB accelerators and deals with realtime social stuff, so once an hour doesn't cut it) 1) Can I have a cron job that contains "run(), sleep(60), run()..." that lasts for 60 minutes? 2) Frequency of running aside, it currently outputs: ...web/public/mysqltest.php: ?php: ca...

How do I alter array keys and values while using a RecursiveArrayIterator?

I suspect I'm doing something stupid here, but I'm confused by what seems like a simple problem with SPL: How do I modified the contents of an array (the values in this example), using a RecursiveArrayIterator / RecursiveIteratorIterator? Using the follow test code, I can alter the value within the loop using getInnerIterator() and off...

import mysql data to a table, edit/clone rows, and insert new rows

Is there already any software that will allow me to select a table or row from existing DB, edit that table, add new rows, or clone existing ones, then insert the new rows back into the DB? Read: i want to ADD this data, do not want to update/replace existing data. PHP5, and MySQL 5 ...

Processing many rss/xml feeds in a cron file without overloading server

I have a cron that for the time being runs once every 20 minutes, but ultimately will run once a minute. This cron will process potentially hundreds of functions that grab an XML file remotely, and process it and perform its tasks. Problem is, due to speed of the remote sites, this script can sometimes take a while to run. Is there a sa...

Getting Oracle's MD5 to match PHP's MD5

Hi all, I'm trying to compare an MD5 checksum generated by PHP to one generated by Oracle 10g. However it seems I'm comparing apples to oranges. Here's what I did to test the comparison: //md5 tests //php md5 print md5('testingthemd5function'); print '<br/><br/>'; //oracle md5 $md5query = "select md5hash('testingthemd5fun...

TextBox Search string manipulation

This is sort of complicated for me to explain,let me try anyway. i want to know how can i manipulate the string i've collected from this(such type of ) textbox and use it for my pupose in webapp or dektop app. i mean for example, i've two situations. 1) If i've to take the search string in text box and want to forward user to say s...

Using constants as default function values in PHP

Is this legal? <?php function ftw($foo = 'pwnage', $nub = MENU_DEFAULT_VALUE, $odp = ODP_DEFAULT_VALUE) { //lots_of_awesome_code } ?> where MENU_DEFAULT_VALUE and ODP_DEFAULT_VALUE are previously constants defined previously in the file. Thanks. ...

How to use a doctrine construct function

Doctrine documentation says you can use public function construct() { ... } as a construct function since __construct can't be overridden. When I place it in my code and put a echo in it public function construct() { echo "constructing..."; } it isn't called during the construction of the object. How is it supposed to be called o...

How do I send a literal parameter via Doctrine to the DB?

If I want to do something like this (notice the expires line): $duration=24; //in hours $reset=new PasswordReset(); $reset->code=md5(uniqid()); $reset->expires="now() + interval $duration hours"; $reset->User=$user; $reset->save(); How can I get Doctrine to NOT quote it before sending it to postgresql? I know I could do this in PHP, ...

Write MySQL output to file

I have a mysql query that runs in a php file that outputs a page of data. I need to somehow output that data to a file, to allow me to perform client side functions on that data as needed before exporting it for download. I need the temporary file named as a timestamp. Im wondering if i should use the fopen to create the file with the n...