Jump to content

Search the Community

Showing results for tags 'if statements'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 4 results

  1. I am trying to call a user defined function in an if statement when the condition is true. if($number_of_rows_after>$number_of_rows_before) { myFunction(); echo "this my if"; } else{ echo "this is my else"; } myFunction() is getting called regardless of whether or not my condition is true or false so i will have "this is my else" echoed and myFuction() runs
  2. Hi Guys I am wanting to create a menu page which displays menu's based on if the menu field in the sql database has a yes or no in the contents by using an if statement. I have not had much success and would like some help to point me in the right direction. <?php include("../edb.php"); $id =$_REQUEST['id']; $result=mysql_query("SELECT * FROM `eusers` WHERE id='".$_SESSION['uid']."'"); if($MENUAdviser="Y") echo '<script type="text/javascript" src="ExtranetMenu.js"></script>'; if($MENUPAS="Y") echo '<script type="text/javascript" src="PASMenu.js"></script>'; if($MENUStaff="Y") echo '<script type="text/javascript" src="IntranetMenu.js"></script>'; if($MENUWebAdmin="Y") echo '<script type="text/javascript" src="WebAdminMenu.js"></script>'; ?>
  3. Hi everyone, I'm in the process of developing a site for my school which allows students and teachers to log in to do different things. At the moment I'm working on redirecting people from a page that requires them to be logged in as teachers. I've got a bit of code that works already which directs people away from the page and gives them a message. That code is here: <?php session_start(); if (empty($_SESSION['userName']) || $_SESSION['member_type'] == 'Student' ) { $_SESSION['msg'] = 'You must be a teacher to access the teachers.php page'; header("Location: login_required.php"); die(); } ?> However, I'd like to tweak this a bit so the message is customised, based on whether the person is: i) currently logged in as a student ii) not logged in at all iii) or else, if they're logged in as a teacher, simply displaying the page as normal. The code I've tried is this: <?php session_start(); if (empty($_SESSION['userName']) ) { $_SESSION['msg'] = 'You must be a teacher to access the teachers.php page. You are currently not logged in.'; header("Location: login_required.php"); die(); } else if ($_SESSION['member_type'] == 'Student'); { $_SESSION['msg'] = 'You are logged in as a student, but you must be a teacher to access the teachers.php page'; header("Location: login_required.php"); die(); } ?> This works by giving the correct messages to people who are either students or who are not logged in. However, if I am logged in as a teacher, I am still given the message saying "You are logged in as a student" etc...rather than having access to the page. I'd be greatly appreciative if anyone could point out my error. Thanks greatly, Dave
  4. Hello, I can't achieve what I am looking to do here: <html> <head> <title>PHP Weekend Challenge</title> </head> <body> <?php \\*if month = december and day = 23rd and time=19:00-23:59 echo "Good Evening, tomorrow is Christmas Eve!" or if month = december and day = 24th and time=19:00-23:59 echo "Good Evening, tomorrow is Christmas Day!" else echo "It's not Christmas so too bad - it's just another 7 day working week!"*\\ ?> </body> </html> I'm a newbie so please assume I know nothing about PHP and provide as much explanation as you can for the solutions you give. I have read around on different websites and I find it exceptionally difficult to understand them because of my dyslexia and dyscalculia. Please advise :-) Thanks and Kind Regards, Beanie
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.