GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Any PHP guys here? Need quick help with an IF statement (https://gfy.com/showthread.php?t=892881)

teh ghey 03-10-2009 09:53 PM

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 03-10-2009 09:59 PM

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

teh ghey 03-10-2009 09:59 PM

Quote:

Originally Posted by tical (Post 15611164)
<? if ($logged_in == 1) && ($blah == 2) { whatever } ?>

cool thank you

teh ghey 03-10-2009 10:05 PM

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 '}'

jimbona 03-10-2009 10:06 PM

Code:

<?PHP
if($logged_in == 1 && $_SESSION['group_id'] == 5)
{
  //do whatever
}
?>


who 03-10-2009 10:12 PM

Code:

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


teh ghey 03-10-2009 10:13 PM

Quote:

Originally Posted by jimbona (Post 15611175)
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 ?>
?

teh ghey 03-10-2009 10:15 PM

Quote:

Originally Posted by jimbona (Post 15611175)
Code:

<?PHP
if($logged_in == 1 && $_SESSION['group_id'] == 5)
{
  //do whatever
}
?>


nevermind that crashed too

Parse error: syntax error, unexpected '}'

sarettah 03-10-2009 10:16 PM

Quote:

Originally Posted by teh ghey (Post 15611173)
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>


jimbona 03-10-2009 10:16 PM

Quote:

Originally Posted by teh ghey (Post 15611195)
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.

gornyhuy 03-10-2009 10:18 PM

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.

teh ghey 03-10-2009 11:38 PM

Quote:

Originally Posted by gornyhuy (Post 15611215)
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 -->

jimbona 03-10-2009 11:46 PM

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

<!-- --> is a HTML comment syntax

2012 03-10-2009 11:54 PM

im an expert at the PHP's.
I will get back to you shortly
brb.

teh ghey 03-10-2009 11:57 PM

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

ExLust 03-11-2009 02:02 AM

Yeah, you better ask the software developer.

james_clickmemedia 03-11-2009 03:54 AM

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.


All times are GMT -7. The time now is 01:23 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123