|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
list links in order of pop.
on my fantasy football site I have a <div> that holds 5 outside links. I pull these from my mysql table (more than 5 eventually.) How can I count the number of times each link is used and order it by most popular. I'm guessing by another field in db that increments. I'm just not sure how I will do that by having the person clicking a link to an outside site.
I know the SQL statement will be like: "SELECT * FROM TABLE ORDER BY rank LIMIT 5;" Thanks in advance |
|
#2
|
||||
|
||||
|
RE: list links in order of pop.
Well have the links point to a page like out.php?page=http://somesite.com. And then on out.php have some sql like "update table set counter=counter+1 where url=$page". Also make sure counter isn't an auto_increment when you make your new field. Then when you show the links go "select * from table order by counter limit 5".
|
|
#3
|
|||
|
|||
|
RE: list links in order of pop.
if I have the links point to a page like out.php then will have to redirect the page to the outside link? I don't think I'm understanding how the "UPDATE..." query will run. The query its self is perfect though. Could you just explain the "bridge" page idea a little more for me.
|
|
#4
|
|||
|
|||
|
RE: list links in order of pop.
|
|
#5
|
|||
|
|||
|
RE: list links in order of pop.
I've never redirected a page before (kind of sad to admit). All I have to do is use header() to resend the header and change the page?
|
|
#6
|
|||
|
|||
|
RE: list links in order of pop.
Yup, using header("Location: ...") is all you need to do. Make sure, though, to not output any content (echo, print, ...), otherwise it probably won't work...
|
|
#7
|
|||||
|
|||||
|
RE: list links in order of pop.
I don't want the user to leave index.php. Can I just repost the page to its self?
before click (index.php) after click (index.php) php Code:
by the way, thank you for all your help guys! |
|
#8
|
|||
|
|||
|
RE: list links in order of pop.
nevermind, on the last post. I want it to be opened on a new page so the way that you guys originally explained. Thanks
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > list links in order of pop. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|