php

Assign thumbnail to new wordpress category

I am building my first wordpress theme and was hoping that when the user made a new category, there was a way of automatically generating a thumbnail for it from the first image uploaded as a post to this category (it is a portfolio theme). Does anyone know how this might be coded? It cannot rely on hard coding as the user does not kno...

Interprocess communication within PHP with a continous process?

I have a question about interprocess communication within PHP. What I want is to have one process to be continuously running, and to have other processes communicate with this one.Is this possible? ...

Zend DB - Count(*) not working...

My sql statement is not working with Zend, its complaining about the Count(*) field... what am I doing wrong? // get open/closed $stmt = $db->query('SELECT status, count(*) as total FROM reported_issues WHERE date_reported >= '.$today.' AND status IN (0,1) GROUP BY status'); while ($row = $stmt->fetch()) { switch ($row['status']) ...

Can I get CONST's defined on a PHP class?

I have several CONST's defined on some classes, and want to get a list of them. For example: class Profile { const LABEL_FIRST_NAME = "First Name"; const LABEL_LAST_NAME = "Last Name"; const LABEL_COMPANY_NAME = "Company"; } Is there any way to get a list of the CONST's defined on the Profile class? As far as I can tell,...

how to create username from email address provided - PHP

I have a signup page on my website where a user must provide a email address and password only. I want to be able to create a username for this user automatically by using the first part of the email provided; User supplies [email protected], i want to make username 'gordon' I don't need explanation on how to create form or submis...

Convert PDF to HTML

What is the best solution to convert PDF documents to be viewed in the browser as HTML? The site has several PDF documents and the visitor can click on view as HTML and this should be viewed on the screen as an HTML file. Standard website running PHP, Linux, Apache. ...

Clean up PHP/HTML pages

Does anybody know of a good tool that cleans up files with php and html in it? I've used Tidy before but it doesn't do a good job at leaving the php code alone. I know there are various implementations of tidy but does any tool reign champion specifically for pages with html and php? Thanks ...

Sanitize user input destined for database in PHP

I have this code: $query = "select id from votes where username = '$user' and article_id = $this->id"; I tried this code to sanitize it: $query = sprintf("select id from votes where username = '$user' and article_id = $this->id", mysql_real_escape_string($user), mysql_real_escape_string($password)); but I get this error ...

Need Help Optimizing php string difference function

I created this function and it works on small strings, but for longer strings it times-out. I'm looking for a way to make the function work faster and not timeout, or a better way to accomplish what I want. function find_diffs($string1, $string2) { $array1 = preg_split("/\b/", $string1); $array2 = preg_split("/\b/", $string2); ...

Exception handling in PHP: where does $e goes?

I been searching for this and I just seem to run into the same articles, in this code: try { //some code } catch(Exception $e){ throw $e; } Where does $e gets stored or how the webmaster see it? Should I look for a special function? ...

Speed up code when change in layout

Hi, I have website on php which have customization facilities for user. When user change any layout the page will refresh and take much time to load. I want to speed up the change in page layout. The containts of page will be same but font -size ,back ground can be change without much time spending. Please help me. Regards. ...

MySQL vs Web Server for processing data

I was wondering if it's faster to process data in MySQL or a server language like PHP or Python. I'm sure native functions like ORDER will be faster in MySQL due to indexing, caching, etc, but actually calculating the rank (including ties returning multiple entries as having the same rank): Sample SQL SELECT TORCH_ID, distance AS t...

wordpress wp_list_categories() help

any ideas on how this can be formatted to print out extra attributes in the wp_list_categories function? at the moment, this functions returns the following values <ul class="projects"> <li class="wp-post"><a href="category/projects">Projects</a></li> </ul> How can I change this function to out put 'id' and 'title' tags ...

Get Domain of IFrame?

Is it possible to get the current URL that an IFrame is set to if it's loading an outside page (say, Wikipedia)? I've seen a few people say that it is impossible if it is not on your own server, but the places I've found that were 4 years old. If it is impossible, is there an easier way to display a page inside another page and still h...

Send Page Requests Through Server?

Would it be possible if a user clicked on a link inside an iframe showing an outside site to have the webpage request be routed through the server that the iframe is hosted on? Example: Iframe on somesite.com showing google.com User clicks a result link to someothersite.com The request is sent through somesite.com's server and is logged...

Why do I get this function call error on an non-object when I am calling a function on an object?

Error: Fatal error: Call to a member function bind_param() on a non-object in /var/www/web55/web/pdftest/events.php on line 76 Code: public function countDaysWithoutEvents(){ $sql = "SELECT 7 - COUNT(*) AS NumDaysWithoutEvents FROM (SELECT d.date FROM cali_events e LEFT JOIN cali_dates d ON e.event_...

HTTP forms using raw PHP

My initial strategy at developing forms was like this: the form post back to the same page and in the page handler I start by looking for POST variables and taking appropriate actions, then display the page content. It was all looking rosy in the beginning. I would place a hidden field inside my form and the page to keep track of current...

CGI-PHP error and Redirection Issue Wordpress MU

Hi, I installed wordpress Mu at http://www.optimalthinking.com/community/wp-admin/install.php But when I visit http://www.optimalthinking.com/community/ I get Security Alert! The PHP CGI cannot be accessed directly. This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be ser...

Next month, same day in PHP

I got a last time (and urgent) requeriment of an "event" that needs to be scheduled the same day of every month. Say of you set the start date on the 1st May you should get the next events on the 1st of Jun, 1 Jul etc. The problem comes with a start date on the 31st (the next ones could be 30 or 28 depending on the month) Considering ...

MySQL Database Design Optimized for Data Retrieval in PHP

Hi all, I am a fairly new MySQL developer and am starting on a project that I could do with a bit of initial advice on... I am creating a database that will primarily be holding a certain number of items (between 1-5k) and around 40 boolean variables associated with each one. Users will then be inputting their choice of these 40 value...