Results 1 to 4 of 4

Thread: dynamic column query mysql

  1. #1
    Join Date
    Nov 2010

    dynamic column query mysql

    Hey all,

    I am trying to make a script where I can query for a column that changes depending on a passed variable. So I have a variable passed called division, lets say it will be a, b, c or d.. I want to get the value in the column division_value1. I initially tried:
    PHP Code:
    $row mysql_fetch_array($query)
    $result $row[$division 'value1'
    but it didn't work and I feel it's probably not what I should be trying.. Any suggestions would be appreciated

  2. #2
    Join Date
    Mar 2014
    I realize this is 4 years old but I am trying the same thing, did you ever get an answer?

  3. #3
    Join Date
    Aug 2004
    Well, it looks like the OP left out the underscore, but I have no idea if that has anything to do with your problem (or was, in fact, his only problem). I'd suggest posting some details and showing us what code you have tried so far?
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  4. #4
    Join Date
    Nov 2010
    Quote Originally Posted by mikednnz View Post
    I realize this is 4 years old but I am trying the same thing, did you ever get an answer?
    Hey - I don't know if I solved it (sorry) - I think I may have just pulled all columns then compared them in php since there wasn't that many to go through..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center