php

PHP Upload a CSV file

Hi, I want the following functionality using php I have a csv file. Each file corresponds to a row in my database There is a html form that will allow me to choose the csv file. Then once the form is submitted, I must parse the csv file and insert data into the db accordingly How do I go about doing this ? ...

Benchmarking PHP page load times

How could I measure the time taken to load a page (with various different PHP statements)? Somewhat like the stats available here - http://talks.php.net/show/drupal08/24 ...

PHP Transferring Photos From One Oracle Database Table to Another

I am attempting to transfer a set of photos (blobs) from one table to another across databases. I'm nearly there, except for binding the photo parameter. I have the following code: $conn_db1 = oci_pconnect('username', 'password', 'db1'); $conn_db2 = oci_pconnect('username', 'password', 'db2'); $parse_db1_select = oci_parse($conn_db1,...

best way to store php data on a page for use with javascript/jquery?

Ok, so im trying to work out the fastest way of storing data on my page without slowing the page load: I need to store information in the page to be later used by jquery. My page is an events page and i want to attach data to each event anchor. there are 100+ events to attach data to. The events anchors are created with a php loop, s...

Finding the index of a given value in a pre-sorted array

Today, I went for an interview and the interviewer asked me how I would find the index of a given value (number) in a pre-sorted array like this: $preSortedArr=array(23,32,36,41,45,54); He also said that using recursion is not allowed. I think the function should look like this: function findIndexByValue($preSortedArray,$value){ ...

Proper error handling in a custom Zend_Autoloader?

I'm building a custom autoloader based on Zend Framework's autoloading (related question here). The basic approach, taken from that question, is class My_Autoloader implements Zend_Loader_Autoloader_Interface { public function autoload($class) { // add your logic to find the required classes in here } } and then...

php file creation and how to run my php program

I'd like if someone could give me some advice on creating the php file, i know to php language.but where to write it.i have followed some tutorial to run php file in netbeans but its pathethic to download xamp server,apache http server.can u give me the direct of how make configuration and all.i have window7 ultimate and will file i hav ...

In PHP can I check a boolean on a function call?

I have a function which checks the passed value and returns false or true, if false I want it to add something to an array. The code I've written is below. if(!check_input($_POST['username'])){ $errors[] = "Username"; } Right now it adds to my array anyway, regardless of what is entered in the form. Is the way I've written...

Editing EPS and AI (Adobe Illustrator) files with PHP

I'm looking for PHP tool to edit *.eps or *.ai files? I need to add any new shapes or text to these files. Is there any way to do this? ...

Is there a script that can dynamically list the contents of a folder?

I am redesigning my company's intranet site in Wordpress and one of the things they need is an archive of company memos. There are over 300 memos saved in one location and I'm wondering if there is a jQuery script that I can run that will read the contents of a local (network) folder and auto-generate a list of the contents of that folde...

Wordpress - using 'get_post' to select only those posts that are in two specified cats at once.

I am trying to use 'get_posts' to pick up posts that are in two categories. Currently I am using this: $myposts = get_posts('numberposts=1&category=4&category=7'); This picks up posts that are either in category 4 or 7. The posts I want to pick up must be in both categories at once. Any suggestions? ...

Examples of Proprietary/Commercial web application licenses

Do you know any well-written commercial licenses of web applications written in PHP? I'm going to review the PHPDocs appended to each file in our private library and I'm looking some inspiration to do it right. How to avoid unauthorised copying, reusing and so on. There are plenty good examples for Open Source Software but I haven't fo...

How to send xml to a php page

I have a client application that gives its output as an xml file, i want the xml to be sent to a remote server and processed using php... ...

How to offer large audio files for download after payment

Hi, I want to offer audio files for download on my site, after a user has completed a PayPal transaction. The commerce side of it is already written and working - the site is built in PHP with Zend Framework. So that I don't incur large charges for storage and bandwidth, I'd like to host the files on a service like Amazon S3. However, ...

Minimum 4 Characters or Show Nothing - PHP

Hi, I want to show up only words with minimum 4 Characters, actually I can limit the hits and show only words with min. 100 hits - but how can I set a min. character length? thank you! function sm_list_recent_searches($before = '', $after = '', $count = 20) { // List the most recent successful searches. global $wpdb, $table_prefix; ...

PHP MYSQL Add up number of entries in single table and display in HTML

I have a table called activities which contains a number of activities for projects (for example 6 activities are related to one project). On projects page, you can see the projects, and I have one column which needs to display the number of activities associated with the project. So basically, I need a query or PHP calculation that can...

php POST and non-english language chars passes empty

I'm trying to program a Hebrew site with a search option. (old site and the charset of this site is windows-1255) I am using php 5.2 with Apache 2.2, on a Debian 5 (Lenny) with appropriate code pages enabled. I am using _POST to pass arguments to a script. If I pass English word to the script everything works, but when I use Hebrew noth...

Attching a Behaviour to a dynamically created table in Doctrine

How do I programmatically attach a Doctrine Behaviour to a table dynamically created through $conn->export->createTable('MyTable', $definition)? For example, if I have the following code: $definition = array( 'id' => array( 'type' => 'integer', 'primary' => true, 'autoincrement' => true ), 'name' => ...

Ajax: distinguish old posts and new posts.

Hi at all, I have created a very simple blog at www.example.com with a only one page. When I connect to www.example.com I see all posts inserted in the database ( in mysql ). Now I want that every 60 seconds an ajax request check in the database if there are new posts. If there are new posts these will be inserted at the top above the o...

get RSS feed into php array - possible?

I want to parse an existing RSS feed from another website with php and then store certain parts of it in a mysql database. I'm very competent with php and mysql but have never worked with rss feeds before, where should i start? is there an equivalent to file_get_contents() for getting rss into php? are rss feeds broken down into xml/m...