Jump to content

Is there a way??


almightyegg

Recommended Posts

As I said last time you where playing with this idea, you need to rethink your logic. $variables simply hold values, they can be named whatever, but dynamically naming variables and trying to manipulate them in such a way is not usually the right way of going about things.

 

Maybe if you explained the bigger picture we could offer an alternative.

Link to comment
Share on other sites

It's needed in this function type thing:

$im = imagecreate(150, 100);

$i = 1;
$h = 1;
while($i <> 16 && $h <> 11){
$p = ${"p" . $i . "d" . $h};
$f = ($i-1)*10;
$s = $i*10;
$g = ($h-1)*10;
$r = $h*10;

$black = imagecolorallocate($im, 102, 51, 0);
$red = imagecolorallocate($im, 255, 0, 0);
$brown = imagecolorallocate($im, 255, 147, 28);
$turq = imagecolorallocate($im, 153, 255, 255);

$flares = mysql_fetch_array(mysql_query("SELECT * FROM itemsowned WHERE userid = '{$mem['id']}' and code = 'flar'"));
$vmap = mysql_fetch_array(mysql_query("SELECT * FROM itemsowned WHERE userid = '{$mem['id']}' and code = 'vmap'"));
$flares = $flares[amount];
$vmap = $vmap[amount];

if($p == x){
imagefilledrectangle($im, $f, $g, $s, $r, $black);
}elseif($p == v && $vmap == 1){
imagefilledrectangle($im, $f, $g, $s, $r, $turq);
}elseif($p == m && $vmap == 1){
imagefilledrectangle($im, $f, $g, $s, $r, $turq);
}else{
imagefilledrectangle($im, $f, $g, $s, $r, $brown);
}

if($i == 15 && $h == 10){
$h = $h+1;
$i = $i+1;
}elseif($i == 15){
$i = 1;
$h = $h+1;
}else{
$i = $i+1;
}

}

 

This works (mostly) but I want to add another if.

 

Basically I want to say if(the-point-the-user-is-on == p$id$h){ etc..

 

That make more sense?

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.