php

How do I style a PHP form RESULTS page?

Hi, I've gota working form that when you click "submit" it takes you to a results page - all fine. However, is it possible to add divs etc to make the page look a bit nicer? If so, how? At the moment when i add divs in it just ignores them! Thanks, Steph <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www....

.htaccess subdomains and common files

Hello I have a file structure that serves mutliple domains with a top level .htaccess pushing requests down to the domain specific directories: ... ReWriteCond %{REQUEST_URI} !webroot/domains/www.sitea.com/ ReWriteRule ^(.*)$ webroot/domains/www.sitea.com/$1 [L] ReWriteCond %{REQUEST_URI} !webroot/domains/www.siteb.com/ ReWriteRule...

PHP ini date.timezone? Server or client location time zone?

I know this might sound a silly question, but I did not find in PHP documentation somewhere were they state loud and clear this one. I have got a web application. Users of my web appliations are in Europe, but the server running the web appliation is in US. How should I set the date.timezone php ini directive??? I suppose to where th...

Automatically generate playlist with php

Hi, I generate a playlist with following script: <?php $dir = './music'; $url = 'music'; header('Content-type: text/xml'); echo '<?xml version="1.0" encoding="utf-8"?>' . "\n"; echo '<playlist>'; if (is_dir($dir)) { $dp = opendir($dir); while (false !== ($file = readdir($dp))){ if ('mp3'==strto...

Generating data (using PHP) in a YML fixtures file

I want to generate test data for a fixture file. I wnat to generate the test data instead of having to type in hundreds of records. Assuming my schema is as shown below: foobar_department_def: _attributes: { phpName: Department } id: name: { type: varchar(64), required: true } foobar_qualification_def: ...

scraping a non RSS page to generate a feed

I want to scrape a page that regularly updates (adding new articles with exactly the same structure as previous ones) in order to generate an RSS feed. I can write the code to analyse the page easily, but how do I emulate a ping i.e. when the page updates how can my php script know? Does it have to be a cron job? (Probably a duplicate...

How to add click event to jstree's(jQuery plugin) asynchronous list?

Hello, I want to add click event to jstree's asynchronous list items. The ideal result is: when i click the items in the jstree, the content of the item will be transfered to a sql query as a parameter, and then, the query is executed and display a result set in the same page or in another page. While I don't know how to implement it...

PHP - Access object properties without case sensitivity?

Hi, I'm working on an old app where there is a lot of inconsistency in the naming conventions used. Is there a way to access object properties that ignores case sensitivity? For example, I have an object called currentuser with the attribute Name. Is there any way to retrieve that value like this? $currentuser->name Any advice ap...

What is the right way to save php code in database

What is the right way to save (php, html, js and mysql) code in database ...

Why is the php assignment operator acting as an assignment by reference in this case?

I have some code that appears to behave differently between php4 and php5. This code below: class CFoo { var $arr; function CFoo() { $this->arr = array(); } function AddToArray($i) { $this->arr[] = $i; } function DoStuffOnFoo() { for ($i = 0; $i < 10; ++$i) { ...

Loading iframe from bookmarklet on 3rd party sites kills CakePHP Session

Hi folks, I am trying to pop up an iframe from a bookmark whose contents are from my test app. The test app doesn't do much but let me log in and set some session vars. First I developed this using Perl's Catalyst framework, and it worked great. I could log in to the test app in some window, or the iframe, and it would keep the session ...

Check if an include (or require) exists.

Hi, How do you check if an include / require_once exists before you call it, I tried putting it in an error block, but PHP didn't like that. I think file_exists() would work with some effort, however that would require the whole file path, and a relative include could not be passed into it easily. Are there any other ways? ...

display ['name'] inside of a foreach loop coming from another loop.

is it possible to use the indexes values inside of a foreach loop that is contained inside a partent for each. Look at the script below and observe that in the child for each I use echo'<div>' .$product['name'] . '</div>'; When $product[' name ']; belongs to the parent for each. is that possible? I am looking to use the index ['name '] ...

MySQL Persistent Connections

I have 10 application servers and 1 mysql database. I would like to do connection pooling for mysql, but simply enabling mysql_pconnect() will not work since it'll cause some servers to have more connections than others. What's the best solution for this scenario..? ...

eZ publish to resize image not scale

Hi, In eZ publish at the moment Im using the following in image.ini.append.php [largepic] Reference= Filters[] Filters[]=geometry/scale=580;270 Which does work fine. However for testing purposes I want to resize the image, scaling it up if needed - the image will be 580x270, even if the original image was lower dimension. Thanks. ...

best way to transform a string to array.

I have an array $AR I have a string "set[0][p1]" When given this string, I need the best way to access the array at $AR['set'][0]['p1'] I have total control on that string, so I need not to worry from injections and stuff, and I can be sure it will be well formatted. There is no way I can put the p1 inside ' to be "set[0]['p1']" ...

mysql query php

i am sending an email to 1000 people. i have a php send email. it works fine. i was wondering, in my query, how can i send it 100 at time. is it like this: select * from test limit 0, 100 select * from test limit 100, 100 select * from test limit 200, 100 select * from test limit 300, 100 etc... thanks. ...

Zend Framework - Last Code to Execute Before Layout is Rendered

I want to execute some code right before the layout is rendered, after all other code is executed. Where would I put that code? I am specifically trying to modify the files referenced in the headLink, headScript, and inlineScript view helpers before they're used by the layout. Here are the steps I want to take: Loop over the files i...

Dreaded PHP T_STRING Error on MySQL query returned resource.

I am getting the dreaded PHP error Parse error: syntax error, unexpected T_STRING in /path/to/the/file in line 14 Here is the code: function getSomeList($userid) { $query = "SELECT list_id, username_id FROM user_list WHERE username_id = 1"; $result = mysql_query($query, $this->db); if (! $result ) { $message = ...

Supporting HTTP 100 Continue with PHP

I'm working on a PHP webapp that accepts large POSTed file uploads from specific clients and would like to accept or reject these uploads (based on various headers and other factors, not just size) before the file is uploaded by using HTTP/1.1 100 Continue. Some quick background from HTTP/1.1 spec 8.2.3: The purpose of the 100 (Cont...