chrometweaks.org

How do I upload to iPage's FTP site?

Click Here To View All Answers...


First question I have is How do I upload to iPage's FTP site? Thanks in advance for any answer. Another question on my mind: On my homepage I have a specials box and a top items box that each show three items randomly. For the specails, out of all the items marked special, and for the top items, out of the top 20 sold items. I am trying to get it so that the top items box doesn't display an item in the specails box. I tried this code, but it didn't work.

$top = tep_db_query("select p.products_id, p.products_ordered, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image from "TABLE_PRODUCTS" p, "TABLE_PRODUCTS_DESCRIPTION" pd, "TABLE_SPECIALS" sp where sp.products_id != p.products_id and p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '"$languages_id. "' and p.products_ordered > 0 group by pd.products_id order by rand() DESC limit 20");.

Anyone know how to accomplish this?.

Also, I know this is settling for not displaying any of the specail items whether they came up or not (i.e. if there is 6 special items, three get displayed, but non of the six can have the possibility of being displayed as a top product), can anyone think of a way around that? Not sure I want a way around it but it's a good challenge...

Comments (78)

I'm stumped. I'm not so sure what is the right answer. I'll do some research in Google and get back to you if I got an useful answer. You should email the people at iPage as they probably could help you..

Comment #1

Ok, I found out that the minus does not work in mySQL. Does mySQL have an alternate to the minus? If so I can't find it. Maybe do another query on the specials then somehow compare them?.

Anyone got any ideas?..

Comment #2

Give this a try, I have not tested it..

HTH.

Tom..

Comment #3

No that won't work, not it only works if you give it values, it won't except querys. i.e. products_id not in (5,6,7,8)..

Comment #4

Mmmmm, don't know.....

Standard doc says it should work with subquery not just value......

Http://dev.mysql.com/doc/mysql/en/ANY_IN_S...subqueries.html.

Maybe only on newer versions of mysql?.

Tom.

This post has been edited by.

OceanRanch.

: 03 May 2004, 22:06..

Comment #5

It doesn't make any mention of NOT IN only IN, maybe thats why. What about taking two queries and then comparing the two? I wonder if I could put the results of the ids from the specials table into an array then put those values into the not in statement. I will have to try that today..

You would think I'm not the first one to have a query like this..

This post has been edited by.

Ryanf.

: 04 May 2004, 13:03..

Comment #6

Hey, I just got the answer from an sql forum and thought I'd share it here for any interested parties.

Select p.products_id, p.products_ordered, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image.

From "TABLE_PRODUCTS" p.

Inner join "TABLE_PRODUCTS_DESCRIPTION" pd on p.products_id = pd.products_id and pd.language_id = '"$languages_id. "'.

Left outer join "TABLE_SPECIALS" sp on p.products_id = sp.products_id.

Where p.products_status = '1' and p.products_ordered > 0 and sp.products_id is null.

Order by rand() desc.

Limit 20.

I was close..

Comment #7

On my homepage I have a specials box and a top items box that each show three items randomly. For the specails, out of all the items marked special, and for the top items, out of the top 20 sold items. I am trying to get it so that the top items box doesn't display an item in the specails box. I tried this code, but it didn't work.

$top = tep_db_query("select p.products_id, p.products_ordered, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image from "TABLE_PRODUCTS" p, "TABLE_PRODUCTS_DESCRIPTION" pd, "TABLE_SPECIALS" sp where sp.products_id != p.products_id and p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '"$languages_id. "' and p.products_ordered > 0 group by pd.products_id order by rand() DESC limit 20");.

Anyone know how to accomplish this?.

Also, I know this is settling for not displaying any of the specail items whether they came up or not (i.e. if there is 6 special items, three get displayed, but non of the six can have the possibility of being displayed as a top product), can anyone think of a way around that? Not sure I want a way around it but it's a good challenge...

Comment #8

Hey, I am still trying to get this to work. I found the minus function that should work but I am getting a syntax error. Anyone know how to get the minus to work or get the effect I want? Thanks.

Select p.products_id, p.products_ordered, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image.

From "TABLE_PRODUCTS" p, "TABLE_PRODUCTS_DESCRIPTION" pd.

Where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '"$languages_id. "' and p.products_ordered > 0 group by pd.products_id.

Order by rand().

DESC limit 20.

MINUS.

Select products_id from specials..

Comment #9


This question was taken from a support group/message board and re-posted here so others can learn from it.