php

PHP Json Encoding w/ quote escaping in 5.2?

I'm playing with the flickr api and php. I want to pass some information from PHP to Javascript through Ajax. I have the following code: json_encode($pics); which results in the following example JSON string: [{"id":"4363603591","title":"blue, white and red...another seattle view","date_faved":"1266379499"},{"id":"4004908219","titl...

Pear SOAP and XAMPP on Ubuntu

All, I have installed xampp for linux on ubuntu 9.10. The installation directory is /opt/lampp. The xampp website says PEAR comes with the installation.. I am relatively new to PEAR and want to know the answers for following: Is PEAR installed with xampp or need to be installed separately using synaptic package manager? I browse to /o...

How do I generate an array from a string representation of that array?

I want to generate the array $result_array. There is no error at the page, but not works! that not works ! //BOF: Result Array $result_array = ''; $result_array .= '"messages" => "' . $errors .'",'; $result_array .= '"this_addr_type" => "' . (int)$_REQUEST['edit'] .'",'; if (ACCOUNT_GENDER == 'true') { $result_array .= '"gender_mal...

Codeigniter Date format

I have se the below date format in the codeignitor config.php $config['log_date_format'] = 'd/m/Y'; Ans wen I enter '30/04/2010' in the text input field and tried to save, got he following error ERROR: date/time field value out of range: "30/04/2010" HINT: Perhaps you need a different "datestyle" setting Corresponding query is bel...

Wordpress Custom Themes > How to script Categories, Tags and Excerpt options to appear on "page" editor

I'm using custom WordPress categories for some probably unintended functions, I will admit (things like marking a post no/index just by adding it to my custom "no-index" category, etc). But it sucks that WordPress does not enable pages with all the little extras you get with posts. For example, while the post editor gives you convenien...

How to calculate "time until" a certain date using PHP and the Zend Framework?

I have two Zend Date objects to work with: $now = Zend_Date::now(); $sessionStart = new Zend_Date('2010-04-01 10:00:00', 'yyyy-MM-dd HH:mm:ss'); I need to calculate the time remaining and display in a human readable manner. The session will begin in 7 days. The session will begin in 30 minutes. How can I do this with PHP and the Ze...

How to Store and Retrieve Images Using SQL Server (Server Management Studio)

I am having difficulties when trying to insert files into a SQL Server database. I'll try to break this down as best as I can: What data type should I be using to store image files (jpeg/png/gif/etc)? Right now my table is using the image data type, but I am curious if varbinary would be a better option. How would I go about inserting ...

Match Anything Except a Sub-pattern

I'd like to accomplish what this (invalid I believe) regular expression tries to do: <p><a>([^(<\/a>)]+?)<\/a></p>uniquestring Essentially match anything except a closing anchor tag. Simple non-greedy doesn't help here because `uniquestring' may very well be after another distant closing anchor tag: <p><a>text I don't <tag>want</tag>...

In PHP how do i update values in an asssociative array and store the entire array?

Here's a code example: $array = array(); $array['master']['slave'] = "foo"; foreach ($array as $key => $value) { foreach ($value as $key2 => $value2) { if (preg_match('/slave/',$key2)) { $value[$key2] = "bar"; print "$value[$key2] => $key2 => $value2\n"; } } } print_r($array); Output...

WordPress development?

What's the most effective way to streamline WordPress theme development when moving from a dev to a production environment? ...

Filesize with SWFUpload and Amazon S3

Hello all, I'm currently using SWFUpload to upload files to my S3 bucket. And it's working great. I'm using the script from a website here: http://www.anedix.com/news/article/50 Again, the upload to my S3 works fine, however, I've been running into an issue when attempting to upload larger files. It seems that I cannot upload any...

How to declare more than one header on PHP

I want to send my users to different pages based on user action. So I made multiple functions at the top of the page like so: <?php function one() { header("location: pagea.php"); } function two() { header("location: pageb.php"); } function three() { header("location: pagec.php"); } ?> Of course I get an error because...

run php script continuously ..

i have a database in My-sql which have entries of time there are more than 1000 entries of time . i want to extract time and run a php script exactly at that time.. i have tried to run a php script continuously which check the time but my server does not allow to run script more than 60 seconds EDIT I have to check the db every secon...

PHP copy problem with uploaded file

Hi there, how can I copy two times the same file? I'm trying to do something like this: copy($file['tmp_name'], $folder."1.jpg"); copy($file['tmp_name'], $folder."2.jpg"); copy($file['tmp_name'], $folder."3.jpg"); And how many time does temp files has before it's destroyed by the server? I try ...

Commitment to Zend Framework - any arguments against?

I am refurbishing a big CMS that I have been working on for quite a number of years now. The product itself is great, but some components, the Database and translation classes for example, need urgent replacing - partly self-made as far back as 2002, grown into a bit of a chaos over time, and might have trouble surviving a security audit...

Customizing Drupal user account form

Hello, In my Drupal Site, i will be having two categories of users,say Category A and Category B. When a person wants to create an account on the site, i want to ask them which category they belong to and based on that show the fields on the User Account Form. The fields shown depend on the category selected. The Drupal user account fo...

How can I use multiple PHP header content types on the same page? is this possible?

Is it possible to use multiple header types in one document? For example: header("Content-type: image/jpeg"); header('Content-Type: text/html; charset=utf-8'); returns the whole page as text/html... while header('Content-Type: text/html; charset=utf-8'); header("Content-type: image/jpeg"); Returns the whole page as an image.... Ho...

PHP Get only a part of the full path

Hello, I would like to know how can I subtract only a part of the full path: I get the full path of the current folder: $dbc_root = getcwd(); // That will return let's say "/home/USER/public_html/test2" I want to select only "/public_html/test2" How can I do it? Thanks! ...

Proper usage of double and single quotes?

I'm talking about the performance increase here. From all I know you can echo variables in double quotes ("), like so: <?php echo "You are $yourAge years old"; ?> But single quotes will just return You are $yourAge years old. But what about performance differences? I've always gone by the rule that single quotes are faster because t...

In a (PHP) framework, what would be a good name for a "manager" class?

I'm building a PHP framework and my english is not the best. There are several classes (database abstraction, module, router,...) in my framework and there is a place where they all have to be initialized and executed together. What is a good name for a "master" class that initializes and runs all other classes? ...