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
Share on other sites

You don't set the value of $BetweenClause untill after you are assigning it to $include. So at the point your assigning it it has a NULL value. Move the block of code which generates $BetweenClause to above the if statment.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.