Jump to content

Newb question i think


Brian W

Recommended Posts

if i have $Value1 = "hello"; $Value2 = "world"; $Value3 = "HI"

and I want to combine the two three $helloworld = HI

how could I do that?

 

I'm sorry I don't understand this question.  The '.' is a concatenation string.  So when you write

$Value1 .= $Value2;

 

It's the same thing as:

 

$Value1 = $Value1 ."". $Value2;

 

If this doesn't help please just tell me the three vars and what final result you want.

The variables are from a data base. I'm trying to populate certain cell (out of a 50x50 cell table). If $row_pos['left'] = "4" and $row_pos['top'] = "3", and $row_pos['word'] = "HI"

I want it to come out as $cell4x3 = "HI"

in my table in the cell 4 over and 3 down, there is

echo $cell4x3

Well, it is possible like so:

 

$Value1 = "hello"; 
$Value2 = "world"; 
$Value3 = "HI";
${$Value1.$Value2} = $Value3;
echo $helloworld;

 

However, i agree with ProjectFear that there might be a better solution in the long run if you explain your problem some more.

Sorry, i'm making a game board that has 40 x 40 cells. Each cell was going to have a string (such as 2 across and 1 down would have $x3y1)

Players would add entries into the database with a picture's source from a list I have (20x20px pics) and x and y positioning choices. I then have a repeat field that takes the info from the database and converts it into the image script in the right place.

 

$x3y1 = "<img src=\"$row_pos['src']\" > \\ or something like that.

 

I changed over to a repeating background of chess board like squares to create my board (less script, better refresh time) and set it up to have absolute positioning instead. (tid bit from it: absolute; left; ".10+(20*$row_pos['X'])."...(*20 because each square is 20pixels and + 10 because the screen margins 10 from the top and left.))

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.