Jump to content

[SOLVED] 1 variable = another


sp@rky13

Recommended Posts

So I have this code:

 

<?php $x = $_GET["x"];?>
<?php $x1 = $_GET["x1"];?>
<?php $x2 = $_GET["x2"];?>
<?php $y = $_GET["y"];?>
<?php $y1 = $_GET["y1"];?>
<?php $y2 = $_GET["y2"];?>
<?php $k = $_GET["k"];?>
<?php $k1 = $_GET["k1"];?>
<?php $world = $_GET["world"];?>
<?php $vpt_sub = $_GET["village/player/tribe_submit"]; ?>
<?php
[b]if ($x=='on' AND $y=='' AND $k=='')
	$include = "AND x BETWEEN '$x1' AND '$x2'";
else if ($y=='on' AND $x=='' AND $k=='')
	$include = "AND y BETWEEN '$y1' AND '$y2'";
else if ($y=='on' AND $x=='on' AND $k=='')
	$include = "AND x BETWEEN '$x1' AND '$x2' AND y BETWEEN '$y1' AND '$y2'";
else if ($y=='' AND $x=='' AND $k=='')
	$include = "";
[u]else if ($y=='' AND $x=='' AND $k=='on')
	$include = $BetweenClause;[/b][/u]
$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 village9.village, player9.name, tribe9.tag, village9.x, village9.y
FROM village9
JOIN player9 ON village9.player = player9.id
JOIN tribe9 ON player9.tribe = tribe9.id
WHERE tribe9.tag = 'vpt_sub' $include") or die(mysql_error());

$stop=mysql_num_rows($result);
$i = 1;
while($row = mysql_fetch_array($result))
{
echo "$i".". "."[player]".$row['name']."[/player]"." - "."[village]".$row['x']."|".$row['y']."[/village]"."<br>";
$i++;
}
mysql_close($con);
?>

 

Note the "$include = $BetweenClause;" How can I do that as such as that does not work? :(

Link to comment
https://forums.phpfreaks.com/topic/182051-solved-1-variable-another/
Share on other sites

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.