Jump to content

Less than but within 5?


TEENFRONT

Recommended Posts

Hey all

 

Quick help required, probly really easy... Im doing a traffic exchange system for one of my sites and i need to select partners urls that have less "out" hits than they do "in" hits. I track hits elsewhere. The main issue is i want to do the selecting "within" 5 hits.

 

So if site 1 has 15 in and 16 out, i still want to send another hit to this site, as its within "5".

if site 2 has 20 hits in and 24 hits out, this is ok.

if site 3 has 20 hits in and 26 hits out, this is not ok (because in is over 5 from out) and doesnt want selecting.

 

 

The code i have at the moment just selects sites that have a less out than in value.

 

$sql = "SELECT * FROM links WHERE `out` < `in` LIMIT 1";

 

So thats too simple, i want to still select sites that out is within 5 more of in.

 

More than confused.

Link to comment
https://forums.phpfreaks.com/topic/195995-less-than-but-within-5/
Share on other sites

$selecthits="SELECT * from links where siteid='$sid'";
  $selecthits2=mysql_query($selecthits);
  $selecthits3=mysql_fetch_array($selecthits2);
$hitsin = $selecthits3[hitsin];
$infactor = $hitsin + 5;
$sql = "SELECT * FROM links WHERE hitsout <= '$infactor'";

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.