1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to show content for a Specific User Signed In?

Discussion in 'PHP' started by misohoni, Jun 4, 2015.

  1. #1
    I'm using this guess code below, what I'm hoping to do is open the Session of a user signed in, then only show llala for a specific userID.

    - Any ideas on what I need to do ? thanks guys

    <? if (isset($_SESSION["userID"]))
     
       $query = "SELECT username FROM gifts_users WHERE userID='".$_SESSION["userID"]."'";
    $result = doQuery($query);
    {
    ?>
    llaa
    <? } ?>
    Code (markup):
     
    Solved! View solution.
    misohoni, Jun 4, 2015 IP
  2. Crazy Sdentau

    Crazy Sdentau Member

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    41
    #2
    Hi,

    i think you need an if for show "llala" only for a specific userID. I corrected some syntax errors.
    
    <?
    if (isset($_SESSION["userID"])) {
      $query = "SELECT username FROM gifts_users WHERE userID='".$_SESSION["userID"]."'";
      $result = doQuery($query);
      if( !(is_null($result)) && $_SESSION["userID"] == 10){
        echo "llaa";
      }
    }
    ?>
    
    PHP:
     
    Crazy Sdentau, Jun 5, 2015 IP
  3. #3
    and i think in your db table, the field userID is an integer, so you don't need single quotes
    $query = "SELECT username FROM gifts_users WHERE userID=".$_SESSION["userID"];
    PHP:
     
    Crazy Sdentau, Jun 5, 2015 IP
  4. misohoni

    misohoni Notable Member

    Messages:
    1,717
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    200
    #4
    THanks alot
     
    misohoni, Jun 5, 2015 IP