Monday, June 27, 2011

PHP - Assign variable names to array elements from mysql query

It is useful to be able to take the results of a MYSQL query and assign variable names to the results, so that they can be used later on in a script.

This can be done simply as follows...


$result= mysql_query("SELECT id FROM table WHERE num='567' LIMIT 3") or die(mysql_error());

while ($row = mysql_fetch_array($result)) {

$ids[] = $row['id'];

}
$id1 = $ids[0];
$id2 = $ids[1]
$id3 = $ids[2];


So you now have 3 variables fetched from the mysql array that can be used outside of a loop.

This specific example limits the mysql result to 3. However you could do this for any (change the 3 to how many results you want) and unknown numbers of results doing a COUNT of returned results and then iterating based on that number.

Monday, June 20, 2011

Price Comparison Site Relaunched

findallsorts price comparison site
FindAllSorts.com and FindAllSorts.co.uk were relaunched this week.

FindAllSorts has been split across two domains, one for the UK price comparisons and one for the USA price comparisons.

The site has been rebuilt and improved in both functionality and design. New features are available, the search is better, with the ability to filter product search results so users can be more specific as to what brands or stores or price they wish to check.

There is also a discount vouchers section, where all the online stores discount vouchers are shown and searchable. all coupon codes and special offers are updated daily with details of how long the offer or code will be valid for. So when buying a product it is a good place to check to see if a discount may be available.

UK Price Comparison Site - Find and compare prices of products in the UK. Find discount vouchers, coupon codes and special offers to get yourself the best deal.

USA Price Comparison Site - Find and compare prices of products in the USA. Find discount vouchers, coupon codes and special offers, to get yourself the best deal.

Amazon and Ebay products will also soon be included.

Compare prices to find the best deals at FindAllSorts!