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