php

How to retrieve query string parameter and values using javascript (Jquery)?

Hi <a class="clickme" href="test.php?id=100&status=pending&time=2009" id="p_100">Click me</a> $('.clickme').click(function(event) { event.preventDefault(); var stringId = $(this).attr("id"); var mId = stringId.substring(2) .... I can retrieve the value of id using ID of anchor element. I think I should be able to get it directly ...

OOP design approach for two interacting classes

What are the relative advantages / disadvantages of chaining classes together (or rather; using the results of one class to generate another), compared to nesting classes? I'm trying to restructure my user / authentication system and am wondering whether; myAuthClass should act as a utility and if log-in is successful, simply create a...

listing all jpg files in dir and subdirs

How can I list all jpg files in a given directory and its subdirectories in PHP5 ? I thought I could write a glob pattern for that but I can't figure it out. thanx, b. ...

PHP/MySQL: How to create a comment section in your website.

Instead of asking 'how to use PHP/MySQL to let users affect webpages' I'll ask this, because I learn better from projects and examples. So how would I incorporate a VERY basic comment feature using PHP and MySQL? ...

Migrating from custom ASP & ASP.NET applications to PHP (Typo3)

So we've hired a company to migrate our three websites from custom built CMS solutions to Typo3. One of our sites is still in classic ASP while the other two are in ASP.net 1.1 & 2.0. Typo3 wasn't my choice, but the choice of those with the purse strings. Anyway, the migration of the sites is progressing but I have a problem that nobo...

Free Php encoder

Hello, I dont know whether this is correct posting place, can anybody please suggest me few free php encoding softwares as i dont have any money to buy one currently? FOR ENCODING PHP SCRIPTS / SOURCE CODE Thank You. ...

Unload dynamic class in PHP

I implemented dynamic loading of plugins in the following way: function processPlugin( $plgFile, $db ) { require_once( $plgFile ); $plgin = new PlginImpl(); $plgin->setDb($db); $ret = $plgin->process(); return $ret; } Each plugin defines a class named PlginImpl, which works fine. But it should be possible to call further plu...

multiple mysql queries into one php two-dimensional array

I'm refactoring my code and just hit a snag. The first query in the code below gets the tab_id of the latest submitted tabs. The second Query gets the detail of each tab. In my old way of doing it, i embedded php and html and it was truly an utter mess. Right now I'd like to merge the 2 queries into 1 and/or load it into an array. feel...

entryUUID vs DN

When you need to refer to a precise ldap entry what do you prefer to use entryUUID or DN? I have a grid. every item is a ldap entry. Every row in the grid has a checkbox which contains the item's ID. It could be entryUUID or DN. Which one would you use? I would like to use entryUUID just to avoid situations like http://stackoverflow.co...

Best PHP podcasts

What are some good podcasts on PHP and MySQL? ...

Don't show this if the url contains the following

Hi there, I have a simple div which I don't want to load if the visitor loads up a certain URL. It looks like this: <?php if( stristr($_SERVER['PHP_SELF'], 'blog') == FALSE ) { echo "<div id="stuff"></div>"; } ?> Problem is... it doesn't work... when I load up www.url.com/blog the div#stuff still shows. Am I just lacking sleep or...

ALT text for images in HTML

Hi, We are working on a website that has tons of images and one of the requirement is to have ALT text for each image (JPG, JPEG, PNG, GIF etc). So whenever the HTML shows and image the ALT text for that image is also written to HTML along with IMG SRC. After our discussion with developers the solutions that turned up are 1) Create a...

How can I insert a post into wordpress and associate it with a category?

I have content from elsewhere that I would like to insert as a post in Wordpress and then associate with an existing category. It is pretty straightforward to insert a new post into the wp_posts table, but I can't seem to figure out how to construct a query to both insert a new post and at the same time associate the post with a categor...

Php for loop with 2 variables?

Hi, is it possible to do this? (here is my code) for ($i = 0 ; $i <= 10 ; $i++){ for ($j = 10 ; $j >= 0 ; $j--){ echo "Var " . $i . " is " . $k . "<br>"; } } I want something like this: var 0 is 10 var 1 is 9 var 2 is 8 ... But my code is wrong, it gives a huge list. Php guru, help me !! ...

passing a string by reference to a function would speed things up? (php)

Possible Duplicate: In PHP (>= 5.0), is passing by reference faster? I wonder if by declaring the parameter pass by reference, the PHP interpreter will be faster for not having to copy the string to the function's local scope? The script turns XML files into CSVs, which have thousands of records, so little time optimizations cou...

PHP CMS Plug ins require others

Hi! I'm writing a CMS, but I've got a problem. I have a mysql table called modules. Modules are similar to Wordpress' plug-ins, or Drupal Modules. Some modules require functions of other modules. I'm now writing the part which includes the modules. Here's my code: //Load modules $res_modules = mysql_query("SELECT * FROM ".$db_prefix."m...

Does this simple PHP function wrapper look sensible for its purpose?

Being new to PHP, and with a lot riding on this "function wrapper", I thought I'd get a few opinions and a little feedback. I'd like to get about five comments, if possible. Now before you ask, I have many reasons for wanting to wrap other (WordPress) functions, the primary being hassle-free upgrading. It was also important for me to b...

PHP: How do I get the URL a file is in?

I can't seem to find a super-global for this. Basically, if a PHP file is executed on, say, http://www.example.com/services/page.php, I would like to retrieve http://example.com/services. How do I achieve this? ...

How to install FFMpeg in WampServer 2.0 (Windows XP)

I need to install the ffmpeg PHP extension on my localhost so I can test few of my scripts but I am having troubles figuring out how to do that. I have WampServer 2.0 with PHP 5.2.9-2, my OS is Windows XP. Please somebody give me step by step instructions. I have found some Windows builds here: http://sourceforge.net/projects/ffmpeg-ph...

unlisted reserved word?

I ran into a very strange behaviour in some of our PHP code today. We have a class for dealing with files. It's something like this: class AFile { //usual constructor, set and get functions, etc. //... public function save() { //do some validation //... if($this->upload()) { //save the file to disk $this->upda...