php

what can Phing do that Ant can't?

I'm doing PHP development and I'm thinking of using one of these. I have both PHP and Java installed on my machine. In theory I could use any of the two. What are the compelling arguments to pick Phing over Ant? ...

I have a php form dropdown menu that needs to send information

I have a dropdown menu that is filled by a mysql database. I need to select one and have it send the information for use on the next page after clicking submit. It does populate the drop down menu like it is supposed to it just does not seem to catch the data on the next page. Here is what I have: removeMain.php <html xmlns="http://www...

Unable to delete file locked by same process -- weird!

I have an application written in PHP that uses a COM dll written in C#. The dll creates an image file by combining two other image files. The PHP script then takes over to do the housekeeping tasks of deleting the two source files and renaming the resulting combined file. The problem is the PHP script can't delete one of the source ...

Need to optimize this PHP script for "recent posts". Fatal error when post count is high...

The code below is resulting in an error on a site in which there are ~ 1500 posts. It performs fine when post count is nominal, however, this heavy load is exposing the weakness of the code and I'd like to optimize it. Interestingly, when I disable this menu and instead use the "Recent Posts" widget, the posts are drawn fine. So I'd pr...

Converting John Resig's JavaScript Templating Engine to work with PHP Templates

I'm trying to convert the John Resig's Templating Engine to work with PHP. Essentially what I would like to achieve is the ability to use certain Kohana Views via a JavaScript templating engine, that way I can use the same views for both a standard PHP request and a jQuery AJAX request. I'm starting with the basics and would like to be...

Saving page as PDF or as HTML but with all entries

Hello every one :) I wont to create a pdf from a form on my page, but the Problem is, I need it excactly like the page with form, all entires. So I have for example 2 Input Fields, 7 Radio, 2 Checkboxes, and as result i need a PDF with the same sructure, but if someone check the checkbox, it must be saved in pdf. I have tryed to save...

WordPress > Calling "Recent Posts" widget via script from custom theme

I've tried to code a recent posts script for my custom WP theme, however, it occurs to me that since WP ships with a recent posts widget, ideally I should just be able to call that from within my sidebar.php script, passing it the "Number of posts to show" parameter. Anyone know how to do this? ...

How can I make this SQL query more efficient? PHP.

Hi all, I have a system whereby a user can view categories that they've subscribed to individually, and also those that are available in the region they belong in by default. So, the tables are as follows: Categories UsersCategories RegionsCategories I'm querying the db for all the categories within their region, and also all the indi...

php, user-uploaded files, version control, and website deployment

I have a website that I regularly update the code to. I keep it in version control. When I want to deploy a new version of the site, I do an export and then symlink the served directory name to the directory of the deployment. There is a place where users can upload files, and I noticed once that, after I had deployed a new version, th...

Unable to compare valuesfrom mysql in a prepared statement

I can't seem to get this to connect to the database so that I can run my prepared statement. Does anybody have an idea what I've forgotten? private function check_credentials($plain_username, $password) { global $dbcon; $ac = new ac(); $ac->dbconnect(); $userid = $dbcon->prepare('SELECT id FROM users WHERE username ...

Adding .current_page_item to WP "Recent Posts" widget

When calling WP's wp_list_pages() function, the script builds an unordered list menu and automatically ads a "current_page_item" class to the li element that we are currently viewing (if applicable). I'm trying to get the "Recent Posts" widget to do the same, but I'm unsure how to do it, because I can't find a reference for this argumen...

PHP Bz2 extension question

When I am using bzopen, do I need to bzwrite() already compressed by a bzcompress() string or is it being compressed automatically while writing? ...

MySQL ignores the NOT NULL constraint

I have created a table with NOT NULL constraints on some columns in MySQL. Then in PHP I wrote a script to insert data, with an insert query. When I omit one of the NOT NULL columns in this insert statement I would expect an error message from MySQL, and I would expect my script to fail. Instead, MySQL inserts empty strings in the NOT NU...

Cleaner way of using modulus for columns

I currently have a list (<ul>) of people that I have divided up into two columns. But after finishing the code for it I keept wondering if there is a more effective or clean way to do the same thing. echo "<table class='area_list'><tr>"; // Loop users within areas, divided up in 2 columns $count = count($areaArray); for($i=0 ; $i<$coun...

live search with Jquery

Hello! I am trying to implement a live search on my site. I am using a script somebody has already created. http://www.reynoldsftw.com/2009/03/live-mysql-database-search-with-jquery/ I have got the Jquery, css, html working correctly but am having troubles with the php. I need to change it to contain my database information but everyt...

Why the following upload if condition does not work?

So I have an upload script, and I want to check the file type that is being uploaded. I only want pdf, doc, docx and text files So I have: $goodExtensions = array('.doc','.docx','.txt','.pdf', '.PDF'); $name = $_FILES['uploadFile']['name']; $extension = substr($name, strpos($name,'.'), strlen($name)-1); if(!in_array($extension,$good...

Zend Framework: disable autoloading of base model tables

I use Module Autoloader to autoload resources (forms, Doctrine models etc.). I do not use Zend_Db_Table at all. When I load any Doctrine model, e.g. MyModule_Model_Test, it tries to load MyModule_Model_TestTable too, so I get errors that the MyModule_Model_TestTable.php is missing. To fix this, I may create empty class MyModule_Model_...

Codeigniter: Retrieving a variable from Model to use in a Controller

Hi, I bet this is easy but been trying for a while and can't seem to get it to work. Basically I am setting up pagination and in the model below I want to pass $total_rows to my controller so I can add it to the config like so '$config['total_rows'] = $total_rows;'. function get_timeline_filter($per_page, $offset, $source) { ...

Sites to help me create tag in PHP (like the tags on this site)

I am trying to learn how to create tags in PHP/MySQL. Does anyone know some good sites that help explain how to go about creating tags? Tags as in the tags you see when you ask a question in stackoverflow. ...

Getting PDT code completion to recognise runtime return types from base class?

Hi guys, I've got an abstract base class: abstract class BaseClass { /** * @return CLASSNAME */ public function fluent() { // do stuff return $this; } } Generally, i would put BaseClass where CLASSNAME is and all would be fine, PDT would pick up the phpdoc return type and happily autocomplete. Until, that is, I s...