Jump to content

Making a variable name with partial use of another variable


Phaelon

Recommended Posts

Does anyone know how I can make a variable name with partial use of another variable?

while ($row = mysql_fetch_assoc($result)) {
    $option'.$row['number'].' = 1;
}



So, I would get:

$option1 = 1
$option2 = 1
$option3 = 1

I tried '$option'.$row['number'].'' = 1;, but it didn't work.

No, I want to do it my way because there is a bigger picture to what I am doing which I haven't explained as it is irrelevant and I want to keep my thread simple.

 

... So do you know if what I want to do can be done, or are you just lecture me on what you thinks best without providing any assistance what so ever? :)

Sure they don't.

 

The code you suggested isn't compatible with what I needed to do. I already told you this.

You need to stop assuming you know other people are trying to do.. and if speeds anything to go by, I'd still be stuck if it wasn't for the other help site.

 

You need to stop over analysing in life. I use to have this problem.

 

 

Cheers.

And now you have two problems: utter ignorance and a bunch of crap code.

Agreed..

 

FYI this is what the OP is trying to achieve

http://forums.phpfreaks.com/topic/288403-creating-a-single-variable-for-multiple-mysql-returns-of-the-same-data/

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.