Any PHP guys here? Need quick help with an IF statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • teh ghey
    • Jul 2026

    #1

    Any PHP guys here? Need quick help with an IF statement

    I need to say:
    <!-- IF loggedin_can_upgrade_account == "1" -->
    AND
    <!-- IF session.group_id == "5" -->

    THEN do something I want
    <!-- ENDIF -->


    So how do I put those 2 conditions together? So I just list them seperately, or put them on the same line. I know nothing about php
    thanks
  • tical
    Confirmed User
    • Feb 2002
    • 6504

    #2
    <? if ($logged_in == 1) && ($blah == 2) { whatever } ?>
    112.020.756

    Comment

    • teh ghey

      #3
      Originally posted by tical
      <? if ($logged_in == 1) && ($blah == 2) { whatever } ?>
      cool thank you

      Comment

      • teh ghey

        #4
        didnt work
        I did:
        <!-- if ($loggedin_can_upgrade_account == 1) && ($session.group_id == 2) -->
        <li>{anchor:url1="upgrade/",url2="index.php?m=account_upgrade",name="Upgrade "}</li>
        <!-- ENDIF -->


        I got this error: Parse error: syntax error, unexpected '}'

        Comment

        • jimbona
          Confirmed User
          • Jan 2007
          • 190

          #5
          Code:
          <?PHP
          if($logged_in == 1 && $_SESSION['group_id'] == 5)
          {
             //do whatever
          }
          ?>
          Thanks
          Paul
          Thunder-Ball.net - Member

          Comment

          • who
            So Fucking Banned
            • Aug 2003
            • 19593

            #6
            Code:
            <?PHP
            if($logged_in == 1 && $_SESSION['group_id'] == 5)
            {
               echo 'Juicy';
            }
            ?>

            Comment

            • teh ghey

              #7
              Originally posted by jimbona
              Code:
              <?PHP
              if($logged_in == 1 && $_SESSION['group_id'] == 5)
              {
                 //do whatever
              }
              ?>
              thanks, this is in the middle of a php page, and actually inside another IF statement, so should I take out the <?PHP
              and the ?>
              ?

              Comment

              • teh ghey

                #8
                Originally posted by jimbona
                Code:
                <?PHP
                if($logged_in == 1 && $_SESSION['group_id'] == 5)
                {
                   //do whatever
                }
                ?>
                nevermind that crashed too

                Parse error: syntax error, unexpected '}'

                Comment

                • sarettah
                  see you later, I'm gone
                  • Oct 2002
                  • 14316

                  #9
                  Originally posted by teh ghey
                  didnt work
                  I did:
                  <!-- if ($loggedin_can_upgrade_account == 1) && ($session.group_id == 2) -->
                  <li>{anchor:url1="upgrade/",url2="index.php?m=account_upgrade",name="Upgrade "}</li>
                  <!-- ENDIF -->


                  I got this error: Parse error: syntax error, unexpected '}'
                  Code:
                  <li>
                  <? php
                  if ($loggedin_can_upgrade_account == 1) && ($session.group_id == 2)
                  {
                      echo  'anchor:url1="upgrade/",url2="index.php?m=account_upgrade",name="Upgrade"';
                  }
                  ?>
                  </li>
                  Last edited by sarettah; 03-10-2009, 09:17 PM.
                  All cookies cleared!

                  Comment

                  • jimbona
                    Confirmed User
                    • Jan 2007
                    • 190

                    #10
                    Originally posted by teh ghey
                    thanks, this is in the middle of a php page, and actually inside another IF statement, so should I take out the <?PHP
                    and the ?>
                    ?
                    If you have already initiated PHP to start (i.e. tags opened <?PHP )
                    then you only need the if statement/data.

                    In your code though, you have it surrounded in comments which would cause parse errors as you see reported.

                    If you can post the full code, or the segment your trying to join it into I can advise more.
                    Thanks
                    Paul
                    Thunder-Ball.net - Member

                    Comment

                    • gornyhuy
                      Chafed.
                      • May 2002
                      • 18041

                      #11
                      post the entire code block. You have mixed php and templating system stuff there and you could be fucking it up in any number of ways.

                      icq:159548293

                      Comment

                      • teh ghey

                        #12
                        Originally posted by gornyhuy
                        post the entire code block. You have mixed php and templating system stuff there and you could be fucking it up in any number of ways.
                        i just changed it to this.
                        it doesnt crash, but it doesnt work (display the url I want to group #2



                        <!-- IF app_license == "commercial" -->
                        <!-- IF system_enable_upgrades == "1" -->
                        <!-- IF loggedin_can_upgrade_account == "1" -->
                        <!-- IF session.group_id == "2" -->
                        <li>{anchor:url1="theurliwant"}</li>
                        <!-- ENDIF -->
                        <!-- ENDIF -->
                        <!-- ENDIF -->
                        <!-- ENDIF -->

                        Comment

                        • jimbona
                          Confirmed User
                          • Jan 2007
                          • 190

                          #13
                          Your code above isnt valid PHP.
                          What templating system are you using ?

                          <!-- --> is a HTML comment syntax
                          Thanks
                          Paul
                          Thunder-Ball.net - Member

                          Comment

                          • 2012
                            So Fucking What
                            • Jul 2006
                            • 17189

                            #14
                            im an expert at the PHP's.
                            I will get back to you shortly
                            brb.
                            best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                            Comment

                            • teh ghey

                              #15
                              oh ok, ill ask the software developer tomorrow then. was just hoping to get this done tonight

                              Comment

                              • ExLust
                                Confirmed User
                                • Aug 2008
                                • 3223

                                #16
                                Yeah, you better ask the software developer.

                                BE A PARTNER

                                Comment

                                • james_clickmemedia
                                  Confirmed User
                                  • Apr 2003
                                  • 2204

                                  #17
                                  better of giving one of these guys the php file and they could fix the code in like 2 secs. Its hard to write code blindly when you don't know what else is on the page.
                                  $ CLICKMEMEDIA.COM $ CONVERTING ETHNIC TRAFFIC SINCE 1998 ~ $30+PPS
                                  BLACK-X.COM - NEW BLACK EX-GF SITE
                                  CLICKMEMEDIA.COM ~ ICQ - 8788771

                                  Comment

                                  Working...