Jump to content

php problem


iamburl

Recommended Posts

???

 

I have a table I am trying to access in a particular way and can not so was hoping someone could see what is wrong

 

my table is setup as follows

 

nam

d1

d2

d3

d4

.

.

.

 

what I am trying to do:

 

$sumnum=2;

$a = sql("select * from table where nam='something'");

$arow = mysql_fetch_object($a);

 

 

no good

$checkit = ${"arow->d".$sumnum};

 

 

works

$checkit = $arow->d2;

 

so how can I make the no good code work?

 

Link to comment
https://forums.phpfreaks.com/topic/109338-php-problem/
Share on other sites

why not use mysql_fetch_array, instead of object then you should be able to do

 

 

//note at the end (''];) those are 2 SINGLE QUOTES not one double

$checkit = $arow['d' .$sumnum . ''];

 

 

as far as concatinating an object, I dunno

 

roget that keeb,

 

iamburl, your code is confusing, try changing it to full words and such, the rest of us will thank you, but i think that is what you are looking for

Link to comment
https://forums.phpfreaks.com/topic/109338-php-problem/#findComment-560848
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.