Jump to content

PHP is pissing me off!


TheFilmGod

Recommended Posts

I see 5 variables there.  You really need to provide more info on what the problem is.

 

What problem would that be?

 

What is actually going wrong with it, does it display any errors?

 

Give us something to work with. ;)

 

Sam

 

When I echo the variable, nothing is displayed.

Link to comment
https://forums.phpfreaks.com/topic/82239-php-is-pissing-me-off/#findComment-417994
Share on other sites

Ive no idea what your trying to do because you havent explained yourself at all. However, one problem with your code is that variables are not interpolated within single quotes.

 

You might try....

 

<?php

$i = 3;

while ($i > 0 ) {
  $field = 'a' . $i;
  ${$field} = $row_data[$field]; // you do not need quotes around $field
  $i--;
}

echo $a3."\n";
echo $a2."\n";
echo $a1."\n";

?>

 

Does this help at all? Otherwise, we need more help from you explaining your issue.

Link to comment
https://forums.phpfreaks.com/topic/82239-php-is-pissing-me-off/#findComment-418035
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.