Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Use session variables in recordset

    Hi there!

    I'm brand new to the forum and a n00b at PHP and sql - so don't mind me if i'm talking jibberish...

    that said -

    I'm looking for a way to create a recordset based on session variables.

    I have a sql table that contains four feilds: UserID, ItemDescription, ItemAmt and ItemName. When a client logs into my site, I store their userID and other info in session variables.

    When they have a balance owing, I want to show a region that displays these feilds, and a "pay now" button. The payment functionality has already been created. When no balance is owing, I want to show a region that reflects that, or simply says something like "you have no current balance" or whatever.

    The problem i'm having with the 'show region server behavior' is that when I use 'show if recordset is not empty', it will always show because the UserID feild is never empty. Therefore I need to find a way to only show that region if the other 3 feilds are empty.

    I hope i'm making sense here.

    Can anyone help out a n00b?

    Thanks in advance

  • #2
    Regular Coder
    Join Date
    Apr 2006
    Posts
    111
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Sn0man View Post
    Hi there!

    I'm brand new to the forum and a n00b at PHP and sql - so don't mind me if i'm talking jibberish...

    that said -

    I'm looking for a way to create a recordset based on session variables.

    I have a sql table that contains four feilds: UserID, ItemDescription, ItemAmt and ItemName. When a client logs into my site, I store their userID and other info in session variables.

    When they have a balance owing, I want to show a region that displays these feilds, and a "pay now" button. The payment functionality has already been created. When no balance is owing, I want to show a region that reflects that, or simply says something like "you have no current balance" or whatever.

    The problem i'm having with the 'show region server behavior' is that when I use 'show if recordset is not empty', it will always show because the UserID feild is never empty. Therefore I need to find a way to only show that region if the other 3 feilds are empty.

    I hope i'm making sense here.

    Can anyone help out a n00b?

    Thanks in advance
    Not sure how you'd do that. Maybe you shouldn't use the session variables to detect that? If you have a:

    !empty($_SESSION['user'])

    Maybe there's a way to create an on off loop that doesn't require it. I know that's not much, but I'm assuming it's a bad idea to just use that.

  • #3
    New to the CF scene
    Join Date
    May 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the reply

    I did manage to find a solution, using a "show if condition is true" function.

    <?php if ($row_rsPmts['ItemAmt']>"0"){ ?>


  •  

    Posting Permissions

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