php

How to get the value of a field in PHP?

I need to get the value of a field; I think I am along the right lines but not quite sure this is the proper code. The "Delete Movie" button is where I am trying to get the value of that row like so: value="'.$row['id'].'" Can you help? <?php //connect to database mysql_connect($mysql_hostname,$mysql_user,$mysql_password); @mysql...

how to know which response data is associated with its requested url (in RollingCurl.php) ?

I am writing a web application that grabs (in parallel) the http response headers from multiple sites (with RollingCurl) then stores it in an array and at the end outputs it in JSON format. Since some sites do redirects to new locations, $info (array) in “request_callback” function always contains an url ($info[‘url’]) where the request...

preg_match to match an optional string, but not match all of the string

Take for example the following regex match. preg_match('!^publisher/([A-Za-z0-9\-\_]+)/([0-9]+)/([0-9]{4})-(january|february|march|april|may|june|july|august|september|october|november|december):([0-9]{1,2})-([0-9]{1,2})/([A-Za-z0-9\-\_]+)/([0-9]+)(/page-[0-9]+)?$!', 'publisher/news/1/2010-march:03-23/test_title/1/page-1', $matches); p...

jQuery: Using autocomplete to add values to two fields instead of one

I want to use the autocomplete plugin for jQuery to populate not one, but two fields when selecting one of the autocomplete values - the name of a band is entered in the #band input field, but the band url (if exists) should also automatically be added to the #url input field when selecting the band name. Right now I simply have an un-p...

How to redirect or show a page rather than "Forbidden" when i have directory listings off (htaccess/unix)

Hi, I've set it in htaccess so it won't display the contents of directories, rather it will just show the usual Forbidden page. how can i either: show a certain page or redirect to a certain page rather than just this default "Forbidden" page? thanks ...

How do I add 24 hours to a unix timestamp in php?

I would like to add 24 hours to the timestamp for now. How do I find the unix timestamp number for 24 hours so I can add it to the timestamp for right now? I also would like to know how to add 48 hours or multiple days to the current timestamp. How can I go best about doing this? ...

PHP regex to extract Twitpic link/code if present

I would like to be able to check a string of text and extract a twitpic url if it is present in the string, ultimately I would like just the code portion, but either will do. Example: "blah blah blah http://twitpic.com/1aso4q blah blah" Desired result: http://twitpic.com/1aso4q or 1aso4q Anyone able to help? ...

Can a table have multiple slugs in Doctrine?

Is it possible to have multiple slugs on one table in Doctrine? I tried this in my yaml-file: Article: tableName: tst_article actAs: Sluggable: unique: true fields: [title] canUpdate: true Sluggable: unique: true fields: [text] name: secondSlug columns: id: type: integ...

usleep() php5 uses 40% of idle CPU

Hi guys I have a weird question, I have a cli php script runs on Centos 5.x which uses usleep (somtimes 1sec, sometimes 2sec, somtimes 100ms it depends) if there is some wait required, but what I have noticed its that once on usleep() it seems to use about 40% of idle CPU: Cpu(s): 5.3%us, 21.3%sy, 0.0%ni, 57.2%id, 0.0%wa, 0.0%hi, ...

PHP - XML Feed get print values

Here is my feed: <entry> <id>http://api.visitmix.com/OData.svc/Sessions(guid'816995df-b09a-447a-9391-019512f643a0')&lt;/id&gt; <title type="text">Building Web Applications with Microsoft SQL Azure</title> <summary type="text">SQL Azure provides a highly available and scalable relational database engine in the cloud. In this...

Really frustrated: Help writing a sample twitter app

I have installed WAMP. I have enable cURL in php.ini. I want to implement a twitter app that posts a new status message for a user. Here's my code <?php function updateTwitter($status) { $username = 'xxxxxx'; $password = 'xxxx'; $url = 'http://twitter.com/statuses/update.xml'; $postargs = 'status='.urlencode($status)...

Mod redirect in cakephp

I want to use mod_redirect in cakephp. when user type domain name user should redirect to http://domain.com/index.html. ...

PHP detecting if flash is installed

Hi, is it possible to detect if flash is installed using PHP. My aim is, that if it is installed it will play a flv file, and if not it will use another player eg; quicktime? If it is possible how do I go about doing it? Thanks Tom ...

php frameworks - build your own vs pre-made

Hi, I am building an application currently in PHP and I am trying to decide on whether to use a pre-existing framework like codeigniter or build my own framework. The application needs to be really scalable and I want to be completely in control of it which makes me think I should build my own but at the same time I dont want to reinven...

Web based file manager

Hi, I have been using extplorer http://extplorer.sourceforge.net/ Are there any good alternatives which run on PHP & like extplorer. I am having issues with several folder permissions. ie files that are stored under apache & the ftpuser? Regards, ...

trying to find a web service

i am trying to find a web service that allows a user to send a company name (or better still will return a list of all company names, thus allowing the user to select one) and then get the share price, this will then feed in to another api - yahoo currency converter to work out the price of the share the issue i am having is that i cann...

Regexp: Replace only in specific context

In a text, I would like to replace all occurrences of $word by [$word]($word) (to create a link in Markdown), but only if it is not already in a link. Example: [$word homepage](http://w00tw00t.org) should not become [[$word]($word) homepage](http://w00tw00t.org). Thus, I need to check whether $word is somewhere between [ and ] and on...

Renaming a set of files to 001, 002, … php

I have a set of images in a folder call 'uploads/', all the files are in this form 5f0f905706.jpg, 15758df106.jpg, ... I want to rename them as is, 001.jpg, 002.jpg, 003.jpg ... how i code this? thanks ...

Best way to find updates in xml feed

Hello all, I have an xml feed that I have to check periodically for updates. The xml consists of many elements and I'm looking to figure it out which is the best (and probably faster) way to find out which elements suffered updates from last time I've checked. What I think of is to check first the lastBuildDate for modifications and i...

Symfony 1.4: how to enable non-numerical IDs for routes in admin generator?

My model is built on non-numerical ID's (36-char. GUID to be specific). The problem is that when I run symfony 1.4 admin generator, it assumes that all my IDs are numeric and applies default routing requirements. I tried providing specific routing requirements as advised here: http://www.codemassacre.com/2009/04/27/symfony-12-admin-wit...