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