sp@rky13 Posted October 13, 2009 Share Posted October 13, 2009 Ok so I'm I have the starter code for the website here (the bit you need to see): <td><a class="popInfo w30" href="nojavascript.php" onclick="return false">Minimum Points <span class="box" style="width:30em;"> <span>Enter the minimum number of points you want the barbarians to be equal to</span> </span></a></td> <td><input value="0" size="7" name="pointsmin" style="background-color: #F7EED3;"/></td> <td><input type="checkbox" name="p1" style="background-color: #F7EED3;"/></td> </tr> <tr> <td><a class="popInfo w30" href="nojavascript.php" onclick="return false">Maximum Points <span class="box" style="width:30em;"> <span>Enter the maximum number of points you want the barbarians to be equal to</span> </span></a></td> <td><input value="12000" size="7" name="pointsmax" style="background-color: #F7EED3;"/></td> <td><input type="checkbox" name="p2" style="background-color: #F7EED3;"/></td> </tr> and then we have the code for the php page that receives the data: <html> <head> <link rel="stylesheet" type="text/css" href="style.css"/> <title>Create Barb list</title> <?php function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } ?> <?php $k1 = $_GET["k1"];?> <?php $world = $_GET["world"];?> <?php $pointsmin = $_GET["pointsmin"];?> <?php $pointsmax = $_GET["pointsmax"];?> <?php $p1 = $_GET["p1"];?> <?php $p2 = $_GET["p2"];?> </head> <body> <div id="content"> <pre name="test" style=" margin: 0px; padding: 6px; border: 1px inset; width: 250px; height: 200px; text-align: left; background-color: #FAFAD2 ; overflow: auto"><?php if ($p1=='on' AND $p2=='') include "barb_pointsmin.php"; else if ($p1=='' AND $p2=='on') include "barb_pointsmax.php"; else if ($p1=='on' AND $p2=='on') include "barb_pointsminmax.php"; else if ($p1=='' AND $p2=='') include "query1.php";?></pre> </div> </body> </html> and then the page barb_pointsmin.php: <?php $yLow = floor($k1 / 10) * 100; $yHigh = $yLow + 99; $xLow = ($k1 % 10) * 100; $xHigh = $xLow + 99; $BetweenClause = "x BETWEEN $xLow AND $xHigh AND y BETWEEN $yLow AND $yHigh"; $con = mysql_connect("****","******","*****"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("***", $con); $result = mysql_query("SELECT * FROM village$world WHERE player = '0' AND $BetweenClause AND points >= '$pointsmin'"); while($row = mysql_fetch_array($result)) { echo "[village]".$row['x']."|".$row['y']."[/village]"."<br>"; } mysql_close($con); ?> and then the maximum one: <?php $yLow = floor($k1 / 10) * 100; $yHigh = $yLow + 99; $xLow = ($k1 % 10) * 100; $xHigh = $xLow + 99; $BetweenClause = "x BETWEEN $xLow AND $xHigh AND y BETWEEN $yLow AND $yHigh"; $con = mysql_connect("*****","******","******"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("******", $con); $result = mysql_query("SELECT * FROM village$world WHERE player = '0' AND $BetweenClause AND points <= '$pointsmax'"); while($row = mysql_fetch_array($result)) { echo "[village]".$row['x']."|".$row['y']."[/village]"."<br>"; } mysql_close($con); ?> and the min and max one has this: AND points BETWEEN '$pointsmin' AND '$pointsmax' instead of AND points <= '$pointsmax' Why am I getting really weird results? The point of it is that depending on whivh checkboxes are ticked it will only include the codes that are necessary for it. So if the min one is ticked it is mean to only show results where points are over what is written in pointsmin. It is currently running here if that helps though it obviously still has problems Quote Link to comment https://forums.phpfreaks.com/topic/177493-solved-error-with-larger-then-and-less-then/ Share on other sites More sharing options...
sp@rky13 Posted October 13, 2009 Author Share Posted October 13, 2009 Nevermind. got it solved!!!!!!!! Turned out that i'd made a mistake (which I corrected) but never reuploaded it lol Quote Link to comment https://forums.phpfreaks.com/topic/177493-solved-error-with-larger-then-and-less-then/#findComment-935873 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.