Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 06-02-06
John Jupp's Avatar
The New 'Arfur Daley
 
Join Date: Mar 2004
Location: Kent UK
Posts: 2,352
Thanks: 34
Thanked 40 Times in 30 Posts
John Jupp is an unknown quantity at this point
  Optimising Script

Hi all.

We're still playing with our script and should iron out our newest bug hopefully very soon.

At present a user may look for a specific url by clicking on a merchant listing and a datafeed of that merchants products is displayed on that page set aside to promote the merchant.

What we need to iron out is where the script reads the compiled feed of all merchants for which we have datafeeds and displays all the tens of thousands of pages on the index page so that you may search by keyword.

It takes too long to upload the page because the script is searching the entire database. Suggestions please on optimising display and search results?

The test url is www.personalhomeshopping.co.uk
__________________
Read Our Blog, London/New York/San Francisco Affiliate Program Management - Contact Us
My Contact Details: Terrasip: 21100004227 @ terrasip.net Skype: john_jupp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-02-06
Registered User
 
Join Date: Jul 2005
Location: North Devon
Posts: 664
Thanks: 0
Thanked 2 Times in 2 Posts
futureweb is an unknown quantity at this point
Ha ha me too

test URL
http://www.yomobiles.co.uk/search.php

Last edited by futureweb; 06-02-06 at 10:29 PM..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-02-06
Registered User
 
Join Date: Mar 2004
Location: Reading, UK
Posts: 301
Thanks: 0
Thanked 0 Times in 0 Posts
dmorison is an unknown quantity at this point
What SQL are you using for that homepage search?

Specifically; what is your table structure and what indexes do you have defined; plus what SQL "LIMIT" parameters are you using. That should help us to help you optimise what you're doing.

There's no need for it to take that long, even once you've got millions of products in your database; a paged select should be more or less instant.

Last edited by dmorison; 06-02-06 at 10:58 PM..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-02-06
Registered User
 
Join Date: Jul 2005
Location: North Devon
Posts: 664
Thanks: 0
Thanked 2 Times in 2 Posts
futureweb is an unknown quantity at this point
mines quite basic just an experiment really - the main lag is te image func grabs - where possible (jpg /png) images and creates local thumbs on the fly if the local image exists it displays it else it creates it by copying the remote then thumbnailing it.

not using any limit and using only a single field to perfom the search. the db layout is identical to affiliatefutures tab file out put.
I would normally use a stored proceedure ASP and SQL but my php is a little slack and so the above is work in progress.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #5 (permalink)  
Old 07-02-06
Registered User
 
Join Date: Feb 2006
Location: Gillingham
Posts: 503
Thanks: 0
Thanked 0 Times in 0 Posts
Donk is an unknown quantity at this point
John asked me to reply

MySql 4.0.24
PHP 4.0.24

The relevant section of PHP code is :

$row=$ProdsPerPage*$page;

$query= "SELECT * FROM products";
for ($i=0;$i<$ProdsPerPage;$i++)
{
$query1 = $query." ORDER BY Name LIMIT ";
$query1 .=$row+$i;
$query1 .=", 1";
$result = mysql_query($query1) or die("Select Query failed : " . mysql_error());
$line = mysql_fetch_assoc($result);
// Html to dispslay comes here
}

I've found the problem: I was restructuring the database this afternoon and forgot to index the field "Name";

It works a bit quicker now!

bob
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 07-02-06
Registered User
 
Join Date: Mar 2004
Location: Reading, UK
Posts: 301
Thanks: 0
Thanked 0 Times in 0 Posts
dmorison is an unknown quantity at this point
Hi Donk;

Yes - indexing your name field would certainly help; but it looks from your code as if you're making $ProdsPerPage separate queries to your database instead of selecting all the products you want to display in one go.

If you want to display 10 products page; you should be making a query something like this:

SELECT * FROM products ORDER BY name LIMIT 0,10

You can then loop through the results using

PHP Code:
while($line mysql_fetch_assoc($result))
{
  
// html to display goes here

Then, for each subsequent page; you simply increase the offset by ((Page-1)* ProdsPerPage). Using the variable names from your code; your script would look something like this:

PHP Code:
$offset = ($page-1)*$ProdsPerPage;
$query "SELECT * FROM products ORDER BY name LIMIT $offset,$ProdsPerPage";
$result mysql_query($query1) or die("Select Query failed : " mysql_error());
while(
$line mysql_fetch_assoc($result))
{
  
// html to display goes here

Hope this helps!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 07-02-06
Registered User
 
Join Date: Feb 2006
Location: Gillingham
Posts: 503
Thanks: 0
Thanked 0 Times in 0 Posts
Donk is an unknown quantity at this point
Thanks for the advice I've made the changes.

You can see the results here .

<Just a personal moan> :

If these companies want us to sell their products why do they supply such **** datafeeds ? On page 1 of the test.html are products from Harrods with no data in the name field. Indeed there are some with just a part number and a price. On 118golf there are duplicate records and CDJungle is just that!! over 50% of the images are missing and the price they supply is the RRP not their selling price.

<end moan>

(Note to John I've uploaded products.php to your "com" site you will have to propogate it to all your other sites.)

bob
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #8 (permalink)  
Old 07-02-06
John Jupp's Avatar
The New 'Arfur Daley
 
Join Date: Mar 2004
Location: Kent UK
Posts: 2,352
Thanks: 34
Thanked 40 Times in 30 Posts
John Jupp is an unknown quantity at this point
hehehe. Cheers Bob and cheers too DMorison.

Bob. Bet you're glad you're doing this now. Welcome to the world of affiliate marketing. You're a damned good coder and it's good to have you on board.

Propogating.
__________________
Read Our Blog, London/New York/San Francisco Affiliate Program Management - Contact Us
My Contact Details: Terrasip: 21100004227 @ terrasip.net Skype: john_jupp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
php email script timing out - how to fix please :) Barry Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 2 02-12-05 06:10 PM
Ensuring Affiliate Script Tracks John Jupp Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 1 20-09-05 05:56 PM
Can u call a script from another hosts cron job? DanielCoe Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 5 13-07-05 11:51 AM
Tell a friend script not working! -any ideas? Matt Seigneur Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 6 19-09-04 05:27 PM
Can I run a php script as a cron job? rogerlittin Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 9 17-12-03 11:20 PM


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7