php

How do I list related blog posts ordered by the number of common tags?

I want to display a list of related blog posts and I want the list to be ordered by the number of common tags they have to the current post. Each post can have multiple tags associated to it. Here is my table structure: [Posts] <-- [posts-to-tags-joining-table] --> [Tags] I'm using PHP and MySQL - can I do this in one query? ...

How to create igoogle layout(drag & drop & store) using PHP and AJAX?

In igoogle, we can drag & drop the modules and then if we quit the browser and open it again, the position of each module still the same. I have tested couple of things: When not logged in, igoogle store the modules position in my cookies(cache). Because if I clear cache, it goes back to original position. When I logged in, after posit...

My PHP app needs to export to a range of different XML formats: should I use XSLT or native PHP?

My PHP application will need to be able to export to (and import from) a range of different data formats, mostly XML based. I have the option of In PHP, use DOM to export to some XML based format that is a superset of all the data needed by the others, and create a separate XSLT stylesheet for each output format I want to support, run...

Multiple responses from one AJAX request

Not really looking for code examples here, just concepts. I have three sections on a page now that are being updated via three separate AJAX calls to PHP scripts, which return JSON. What would be the easiest way to condense these three calls into one larger call and receive the responses back on the client in JSON? How would I separate...

Web-Based Music Library (programming concept)

So, I've been tossing this idea around in my head for a while now. At its core, it's mostly a project for me to learn programming. The idea is that, I have a large set of data, my music collection. There are quite a few datasets that my music has. Format, artist, title, album, genre, length, year of release, filename, directory, just...

Reset fields in CakePHP

How to reset all the fields in the form on each refresh in CakePHP? ...

Sort using jquery and php

Hello Gurus what is wrong with this code it works the first time then when i build the header again an error occurs saying From is undefined Jquery function sort(tableHeader,sortDir) { $.ajax({ url: "sort.php", type:"get", data: "tableHeader="+tableHeader +"&sortdirection="+sortDir, success:function(data){ $("#t1").html(data);}...

stripping an url from a text

How do I get to strip a url and put it back in the same position? ...

Getting started with cron jobs and PHP (Zend Framework)

I am totally new to the subject of cron jobs so I have no idea where to start learning about them; when, why, or how to use them with my Zend Framework application, or PHP in general. Can anyone explain the process, with an example, or recommend some good resources to get started? ...

What is Keyword Density and how to create a script in PHP ??

I am working on a project where I have to find out the keyword density of thepage on the basis of URL of that page. I googled a lot but no help and scripts were found, I found a paid tool http://www.selfseo.com/store/_catalog/php_scripts/_keyword_density_checker_php_script But I am not aware actually what "keyword Density of a page" act...

How to get HTML code of a web page in PHP?

I want to retrieve the HTML code of a link (web page) in php. Let's say http://stackoverflow.com/questions/ask this is the link and I want the HTML code of teh page which is served. I want to retrieve this HTML code in a php variable. How can we do this? ...

PHP tag closing-- when is needed?

It's recommended that one should not put a PHP closing tag at the end of the file to avoid all sorts of untoward error. But is there any circumstances when PHP tag closing is needed? ...

Sharing objects between PHP classes

What is the best way to share objects between other classes? For example; a "database" object with functions that are required by the "article" and "user" objects. I don't want to use globals (that includes singletons) or create a new instance of the object in each class, such as function __construct() { $this->database = new dat...

XMLReader encoding error

I have a PHP script which is trying to parse a huge XML file. To do this I'm using the XMLReader library. During the parsing, I have this encoding error: Input is not proper UTF-8, indicate encoding ! Bytes: 0xA0 0x32 0x36 0x30 I would like to know if they are a way to skip records with bad characters. Thanks! ...

Can i get this variable value in this case? (php)

Hi, I pass a variable to domain.com/index.php?user=username In my page (index.php) contains others pages like about.php, profile.php, contact.php etc.. My question is, is it possible that i pass variable to index.php, then about.php, profile.php can also retrieve the variable using $_GET['user']; method??(actually i tried, its failed,...

problem with rss feed and cdata

I have a problem with an rss feed. When i do <title>This is a title </title> The title appears nicely in the feed But when i ddo $title = "this is a tilte"; <title><![CDATA['$title']]></title> The title doesn't appear at all. It still doesn't work. I generate my rss feed dynamicly and it looks like this: $item_template=" ...

Need help with some SQL

<?php if (isset($_POST['email'])) { $email = mysql_real_escape_string($_POST['email']); $password = mysql_real_escape_string($_POST['password']); mysql_query("INSERT INTO accounts (email, password) VALUES ('$email', '$password')"); } ?> <h1>Create Account</h1> <form action="" method="post"> <table cellspacing="3"> <tr> <td vali...

Looking to build myself a tiny, free VMWare image for PHP+MySQL Development.

I'm looking to build myself a VMWare image for PHP+MySQL Development. At present I'm using an ubuntu image which takes ~1 GB of my hard drive space. I'm looking to replace it with something smaller and lighter. So, I'm curious... What do you folks use? It doesn't matter what OS / webserver as long as it's running Php 5 and MySQL. The ...

Weather Api

Hi, I have used yahoo api for getting the weather through zip codes. But the problem is that currently it supports U.S zip codes. For other cities i have to go to weather home page and search for the cities and get the location id then i am able to get the weather conditions. I want to make it dynamic so that a user should only provi...

Referencing for element in a PHP array

Answer is not $array[0]; My array is setup as follows $array = array(); $array[7] = 37; $array[19] = 98; $array[42] = 22; $array[68] = 14; I'm sorting the array and trying to get the highest possible match out after the sorting. So in this case $array[19] = 98; I only need the value 98 back and it will always be in the first positi...