php

PHP MySQLi prepared statements store_result()

Can anyone tell me why my scripts will run out of memory (allocating over 16MB) for a prepared statement that shouldnt need even close to that? The only way I can fix it is by running store_result() before i run bind_result() I am assuming that by using store_result() it tells the script exactly how much memory the statement needs and i...

Are there any decent PHP forums where I can submit program designs and code for critique?

I don't feel that stackoverflow is the best website for getting critiqued on my code, as it caters to single answers. I have always read and practiced alone (aside from some forums) as I did not go to school for programming or computer science, and thus do not have any peers that I can go to for advice, critique, or direction. Are there...

WordPress: Display Other Posts From Current Category

Hi, I have a function going that displays all posts under the same custom taxonomy called "issue". I need to adjust it so that it further narrows it down to also only display posts under the same category. I took a look at the WordPress get_the_category() function but didn't have much luck with that. Here is the code: <?php $issueid...

PHP Variable Scope Issue

I am writing a plugin for WordPress but I can't seem to get my flag going. It is driving me nuts! Here's the code without the class wrapper: static $js_flag; function init() { add_shortcode('jw_html5', array(__CLASS__, 'jw_html5_shortcode')); add_action('init', array(__CLASS__, 'jw_add_js' )); } public function jw_html5_sho...

Is it a bad idea to have set my website up like so?

I was thinking of setting up my website with a file called master.php and using .htaccess and URL rewriting I would transform http://mysite.com/About into http://mysite.com/master.php?selected=About Which would allow me to setup the about page. Is it a bad idea to have one master page that creates dynamic pages? ...

Get title from textfield then use to display function

Hi. I asked this question previously although I don't think I did a great job of explaining it and the answers didn't seem to work so this is my second attempt. FYI, I'm using Wordpress. I wish to create an image slideshow plugin. The idea is that the user can enter the name of the slideshow into a text field then submit it which will u...

PHP foreach($_POST as $key => $value) windows server 2003 IIS 6 problem

In my database connection include I use the code foreach ($_POST as $key => $value) { $_POST[$key] = mysql_real_escape_string($value); } foreach ($_GET as $key => $value) { $_GET[$key] = mysql_real_escape_string($value); } This runs fine on my linux testing server (Cent OS 5.5) however, when it is transferred to the productio...

Refresh Page Auto

Hi, How To auto refresh index (Php Page) or any , after update or insert data to (TABLE) mysql database ? the best example : Gmail (googlemail) . in gmail auto refresh page(inbox) after received new email. ...

Creating executable scripts with PHP

I'm building a module for a CMS that creates its own PHP files. I've received some feedback that a lot of hosting providers don't allow PHP to have write permissions on directories where PHP scripts can be executed. Although the scripts are not technically "executable" (they're just class definitions), I'm concerned that this module may ...

array_unique with two arrays

I have two arrays of the same length ($search_type, $search_term). I want to remove any duplicates in the sense of there being searches that have the same type and search term (ie $search_type[$a] == $search_type[$b] && $search_term[$a] == $search_term[$b]). I'm aware that I could write this using loops, was wondering if there's a si...

Stop a regex matching *everything* after what I want to actually match!

Hey! I am quite new to the whole Regex thing and tried to do a preg_match_all in PHP which, kind of the results I wanted but the problem is it matches everything after what I actually wanted... like so: String: This is something <code>Some code here</code> and more Match from Regex: <code>Some code here</code> and more Wanted match fro...

Retrieve value from a multi-dimensional array in PHP

I have a multidim array that I can view using print_r($users): Array ( [0] => stdClass Object ( [username] => crustacea [created_on] => 2010-08-07 19:54:32 [active] => 1 ) ) I can also use print_r($users[0]). Since there's only one member in $users, the output looks somewhat the...

HTML Drop Down List Best Practices

Hey, I'm putting together a fairly simple HTML/Javascript/PHP form (I am fairly new to all of these). One field of the form requires users to select an option from a reasonably long list (using a drop down list). The contents of the list are extremely unlikely to ever change. Is there a "better" way to populate the list than simply usi...

Need advice on how to better code this function for frequent re-use and adding new functionalities

Hi, I need help to better simplify this process. In order to fully comprehend how everything fits together please refer to my previous post - My Web based system Basically, I want to send more commands to this procedure that I have written. Write now there is only one function I have implemented, detect, but I want to add more in the fu...

How do I select times from MySQL in order based on precedence?

I know that question doesn't make much sense, but here goes: Times Table Authority | Time ------------------------------------- animuson@forums | 45.6758 132075829385895 | 49.7869 qykumsoy@forums | 44.45 439854390263565 | 50.761 user@forums | 44.9 another@auth | 46.123 bingo@nameo | 47.4...

Finding similar number patterns in table

Ok, let's suppose we have members table. There is a field called, let's say, about_member. There will be a string like this 1-1-2-1-2 for everybody. Let's suppose member_1 has this string 1-1-2-2-1 and he searches who has the similar string or as much similar as possible. For example if member_2 has string 1-1-2-2-1 it will be 100% match...

Multi Language SEO URLS

Is having urls like: de/product-name-in-german.html and en/product-name-in-english.html pointing to the same product but in different languages a good practice considering SEO? Does this count as duplicate content? ...

How to call drupal cron multipe times until done

I'm working on a wamp development environment and testing how long it takes to get the site indexed. I'm doing this by running cron manually. The problem is that if there's 700 jobs in the job_queue, each run of cron does only some of them, so I need to run cron several times. How could I keep calling cron in a loop until there are no ...

Apache ErrorDocument after auth_digest has run and failed in apache2.conf

Heya, how goes it? I'm having an issue with apache2. I have a bunch of sites working off virtual hosts on an apache2 box, and a few of them have apache auth setup. When it fails, I wanted to customize the error page (401?), and so I tried throwing in: ErrorDocument 401 "Woops" into the rule, but it didn't work. To make sure I tried th...

Displaying update page once

I am in the middle of developing a new website with my existing site still up and running. What I want to do is redirect the user to an update page when they visit the existing site (regardless of what page they enter on) then redirect them from that update page to the original page they requested. I think the mod_rewrite rule would loo...