Jul 25, 2008

What Does This Do? - $ban = ($data->login) ? $lban : $iban;

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

What Does This Do? - $ban = ($data->login) ? $lban : $iban;

peroim
I'm correcting a 'few' php-files for a friend, but I got this line of code:
CODE
$ban = ($data->login) ? $lban : $iban;

and I don't know what it does xD

Could someone please explain me what this line does?

Thanks

Reply

jlhaslip
That is a terniary (sp) statement. Like an IF statement, but very concise.
If the condition [$ban = ($data->login)] is evaluated to true, then perform the assignment following the '?'. [$lban]
If the condition [$ban = ($data->login)] is evaluated to false, then perform the assignment following the ':'. [$iban]


see also here at the php.net site: http://ca.php.net/manual/en/control-struct...yntax.php#35574

Reply

Amezis
It's the same code as this:

CODE
if ($data->login) {
    $ban = $lban;
}
else {
    $ban = $iban;
}

Reply

FLaKes
Excellent... thanks jhaslip. I had bumped into terniary operators on a php tutorial before but the tutorial explained them and I didnt quite get them. I didnt understand. And a search in google didnt help me much either.

Reply

peroim
i can understand it too now, thanks smile.gif

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : , ban, data, login, lban, iban,

  1. Need Help With My Database [resolved]
    retrive data as a link (6)
  2. Can't Login To Any Software On My Site
    anyone know how to fix? (3)
    In a subdomain of my site I have an installation of MediaWiki, and until now it's been working
    fine. But today I've been having trouble with it. Previously, whenever I logged into MediaWiki
    it worked first time and I would stay logged in for about an hour, even without the "Remember Me"
    option checked. But I tried logging in now, and after logging me in, the next page I went to showed
    me as "not logged in". I cleared the cache as I know this has been a problem before, and then tried
    logging in again, but it still said I was not logged in! So I tried one more ....
  3. [chsupport #ecn-115724]: Ftp/cpanel Login Problem
    (7)
    Please take a look at this. Ticket ID: ECN-115724 Subject: FTP/Cpanel Login Problem Department: CH
    Support Thanks.....
  4. Very Disappointed With Data Center Migration
    What do you think? (9)
    I am hopping mad. I have had nothing but grief since Trap 17 moved their Data Center (DC).
    My site has been down more time than it has been up. I have had to contact Live Support at Xisto 4
    times now in the last month. This is ridiculous. They fix things, it lasts a few days and my site
    is down again. I am at my wits end. I have been told my support to contact Shree. I have
    already communicated with him and he told me that things were solved 6/16, then whatever happened,
    my site was lost completely and had to be restored from their backup. My whole acc....
  5. 1 Terabyte Of Data On A Thumb Drive
    Yes, a whole terabyte! (8)
    Source Seriously, this is innovative. I can't wait for them to produce these...though you know
    the sellers are gonna jack the hell out of the price. In any case, I can only wonder what this will
    mean for desk top and laptop computers. I mean if they can fit a terabyte in a thumb drive with this
    technology, think of how much they can fit into a normal comp. Think of how much music that would
    hold....how many games you could fit.....the possibilities are almost literally endless.....
  6. Cant Login To Cpanel On A Just Made Account O_o
    (2)
    yes,i cant login i can login to normal panel but not to cpanel i get an error every time i login i
    created a ticket some days ago and im not getting a responce please help me ThePro....
  7. Eraser - Erase Your Data Permanently! For Free
    A must have software (7)
    When you delete file and empty recycle bin (Windows), it doesn't actually gone permanently!
    Many software can be used to recover those deleted files. Now think and imagine, you've deleted
    your personal file or something then someone recover and steal it. Don't worry, Eraser will come
    in handy What does it do? It delete files permanently! Nothing and noone can recover it. You
    can make previously deleted files not recoverable too by using Erase unused disk space feature. (if
    you want to sell your harddisk, use this) How can? It uses the patterns used ....
  8. Cpanel Help, Trouble Logging In.
    Cannot login as it states "Login Attempt Failed!" (4)
    Before I was able to login within my Cpanel without problem but now I try to login and it states
    "Login Attempt Failed!" which makes no sense. I made sure nothing was written incorrectly within
    the fields but yet I get this error. ;-; I hope I wasn't hacked or anything.... anyone has any
    idea of what this could mean?....
  9. Login Script For Vbulletin.
    (8)
    For some reason when I try to logon from the main page it doesnt work, it just brings me to the
    forums unlogged. Anyone here have any ideas whats wrong with my coding? Heres the webpage:
    www.ageofilluminati.com Heres the coding im Using: QUOTE
    Forgot password? Register for free! ....
  10. Getting Started With Mysql
    creating tables and insert data into them. (2)
    Hi in this tutorial you will learn how to create tables and insert items into them. First steps are
    to create the database - go into your cpanel and mysql databases, from there make an account and a
    database and then attach them together with all priviliges, call the database test and the account
    admin, with the pw as pass - or any other password. We need to connect to the database so first in
    your php file (probably named index.php) - this is how to do it. CODE
    mysql_connect("localhost", "admin", "pass") or
    die(mysql_error(&....
  11. What Value Would I Use To Insert This Data?
    Help on insertion of data to database? (4)
    I am learning slowly but surely and I know some of you probably getting tired of my questions. ^^;;
    However, I believe one can not learn without asking questions. So.. if I get too bothersome.. just
    point me to some books or something. lol XD // Make a MySQL Connection mysql_connect("localhost",
    "name", "password") or die(mysql_error()); mysql_select_db("at2927_abq") or die(mysql_error()); //
    Insert a row of information into the table "example" mysql_query("INSERT INTO members (pasture)
    VALUES('Timmy Mellowman', '23' ) ") or die(mysql_error()); ....
  12. I Have Install Windows 2003 Server
    I want multiple user to login my server (4)
    I have install windows 2003 server and some application like iis, share point, etc.my development
    time want remote desktop for few user so I want multiple user to login my server but I have not
    install active directory and I don’t want to install so tell me the best way to resolved the problem....
  13. What Is The Best Software
    what is the best software to recovery the data (5)
    Hi any one can tell me what is the best software to recovery the data ....
  14. Data Structures -- Linked List -- Reverse
    Reverse a linked list (3)
    Give an algorithm to reverse a linked list with a time complexity of O(n) and minimal space
    complexity. What is a linked list? Search trap17.com. i Have already answered this question in
    one of my older questions. Solution 1 Here is one simple solution... CODE Void
    ReverseList(node* head) {     node *temp,*current,*result;     temp=null;     result=null;
        current=head;     while(current!=null)     {         temp=current->next;
            current->next=result;         result=current;         current=temp;     }   
    head=result; ....
  15. Simple Php Login And Registration System
    (10)
    Hello. This is my first web tutorial ever. This is basically a simple register and login script.
    Yes, I know it’s a bit rubbish but I’m quite new to PHP/MySQL. Here’s the register form. This can
    be any file extension you like. I’d recommend calling it register.html . CODE
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html
    xmlns="http://www.w3.org/1999/xhtml"> <head> <meta
    http-equiv="Content-Type" content="text/ht....
  16. How Good Is This Data Cleaning Function?
    (2)
    Hi all, this is my first function and as part of a script and i just want to know a couple of
    things. here is the code for the function: CODE <? function
    clean($dirty_string) { $muddy_string = stripslashes($dirty_string);
    $murky_string = strip_tags($muddy_string); $clean_string =
    htmlentities($murky_string);      }; ?> So the first thing is how secure is
    it? the script this will be used in connects to a database and sends an email so it needs to stop
    SQL injections and any email ab....
  17. Innovative Login System
    A new way to login to a website (17)
    Hi, I came across this website www.planmylifestyle.com which offers an innovative login system. In
    the traditional login system, a user is asked to enter a username and password besides many other
    personal information. In this website, to register the site creates an ID file that the user can
    download to the local hard drive. After registration, to login to the website, the user has to
    simply upload the registered ID file (browser and select ID file from local hard drive) and click on
    the Login Button. The user is then taken to the website which seems to be a searc....
  18. Data Can Be Stored On Paper
    Store GB's of electronic data on Paper (31)
    A student has developed a technique to store data on portable paper :-) ....
  19. Get 30 Gb Email For Free
    let us talk about , email system for huge data ! (30)
    Friends here we are talking about largest email, free System http://www.30gigs.com this one is
    good and can handel many file at a time. plz let me know any one having this type of information
    ! Also for small user www.walla.com is good one....
  20. Flatfile User Login/signup
    Uses text files only (compatable with forums and message system) (24)
    With this tutorial, you will learn how to create a textfile login script. This user membership
    script is for use also with my forums and message system scripts. I will also give you the scripts
    to make it so that people can change their profiles. Ok, The first thing we need to do is make the
    database. To do this, create a blank text file called 'userdata.txt' , make sure it is ALL
    LOWER-CASE. Edit this file and put
    '**username|##|password|##|email|##|rank|##|userid|##|name|##|picture**'. This will not be
    used, however it will give you an idea of how the....
  21. Computer Admin Login With Lost Password?
    Hack my own comp. (15)
    Im trying to fix some things on my acount but, i hava to be able to log into my Admin. acount. my
    dad had the comp. before me and he forget the password to get into the acount. how do i hack into my
    own computer to get the password, or is there any way of defragging my comp. without being a admin?....
  22. New Tech: Data Transmiting At 2.56 Terabites Per Second!
    Thats like 60 dvd's per second! (11)
    QUOTE Japanese and German researchers have transmitted data over a 160 kilometer link. This
    breaks the old record witch was held at 1.28 terabits per second. This new technology has
    allowed the researches to transfer 2,560,000,000,000 bits per second witch is the equivalent to 60
    dvd's.And this is PER SECOND ...... Just amazing what these people can come up with,
    stuck in a labatatory with copper wire everywhere,... wait more like fiber-optic. -To me this
    shows the progression of technology and speed of witch we will shortly be able to achei....
  23. C Problem: "two Or More Data Types In Declaration"
    also need help with malloc (5)
    What does it mean when I get the error QUOTE two or more data types in declaration of (function
    name) It's almost the exact same as a function I have in another program that compiles and
    works fine. Also, can someone explain malloc or give me a tutorial? Like where and how you use it,
    and if there are any restrictions to where you can use it. Shortened topic title to fix page
    distortion on the home page. Edit: Made new title make sense >_> ....
  24. My Ipod Is Randomly Skipping Songs, Losing Data,
    regaining data, and freezing (21)
    This morning I was going to listen to some music, so I got my iPod, turned it on, and it reset (I
    hadn't had it plugged in for a while). When I got to the music, it would go through half of a
    song, then skip to the next. After doing this a couple times, it would just skip entire songs.
    It'd skip six or seven, then do half of one, then skip six or seven more. Later I looked on the
    internet for some ideas, so eventually I tried resetting it again, as instructed. This worked for a
    little bit, but then it started skipping over songs again. I reset again, and it lost....
  25. User Login And Tracking
    (4)
    know vba with MSAccess but need to create a web app of an MS Access App. I need to make it multi
    user with the user only being able to see and edit his own data. The db is quite simple and could
    have only a single table, but could divide into one main table with a couple of relational tables.
    I need the user to be able to login in and create his own password. I would want the user to have to
    validate (e-mail) simular to registering for this forum. I noticed that this forum is PHP driven. I
    thought that might be a better solution but a higher learning curve from vba t....
  26. Simple Login In Visual Basic 6
    user interaction example trough login programm (5)
    First of all, I am NOT a programmer, this is something my friend taught me. It describes basic
    interaction with the user, while showing basic functionality of this simple programm. So, without
    further ado, we're off to the tutorial: First of all, start your visual basic, when prompted
    for new project, select Standard Exe . Next, we need to open code window, so we can start typing
    the program. This can be done in two ways, one is double clicking on the form, or selecting Code
    from View menu. If you double clicked on the form, you will see following text: CODE ....
  27. How To Put A Phpbb Login Box On Your Main Site.
    Code and .php included!!! (18)
    I have included my coded file with this... Ok here is the code. CODE // //Create login area,
    replace the phpBB2 in /phpBB2/login.php with your forum's //directory // <form
    action="/phpBB2/login.php" method="post" target="_top"> <table
    width="25%" cellspacing="2" cellpadding="2" border="0"
    align="center">  <tr> <td align="left"
    class="nav"><a href="/phpBB2/index.php" class="nav">Prank Place
    Forum Index</a></td>....
  28. Php Simple Login Tutorial
    Learn how to make a simple login! (63)
    I have been quite busy lately, trying to design and code my site (far from done XD). And after
    having learned how to make a simple login, I will try to write my own tutorial, for you
    /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> the tutorial Step 1
    : The first step in designing a member system is to plan out exactly what you need. A common impulse
    among programmers is to jump right in and start coding. I'll be honest and admit that I'm
    guilty of this more so than anyone. However, since I'm in control of this conversation (y....
  29. Complete Login System
    With PHP + MYSQL (56)
    Its an complete login sistem made and tested by me and I think itwill be very usefull for people who
    are tryn to learn PHP. First, let's make register.php: CODE <?
    include("conn.php"); // create a file with all the database connections
    if($do_register){ // if the submit button were clicked if((!$name)
    || (!$email) || (!$age) || (!$login) ||
    (!$password) || (!$password2)){ print "You can't let
    any fields in blank....
  30. Software To Restore Data
    (15)
    Somebody knows software good to restore data. Yesterday one of my disc crash /sad.gif"
    style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> and i have information that i
    want to restore... Someone knows any program to do this??....

    1. Looking for , ban, data, login, lban, iban,

Searching Video's for , ban, data, login, lban, iban,
Similar
Need Help
With My
Database
[resolved] -
retrive data
as a link
Can't
Login To Any
Software On
My Site -
anyone know
how to fix?
[chsupport
#ecn-115724]
: Ftp/cpanel
Login
Problem
Very
Disappointed
With Data
Center
Migration -
What do you
think?
1 Terabyte
Of Data On A
Thumb Drive
- Yes, a
whole
terabyte!
;
Cant Login
To Cpanel On
A Just Made
Account O_o
Eraser -
Erase Your
Data
Permanently&
#33; For
Free - A
must have
software
Cpanel Help,
Trouble
Logging In.
- Cannot
login as it
states
"Login
Attempt
Failed!&
#34;
Login Script
For
Vbulletin.
Getting
Started With
Mysql -
creating
tables and
insert data
into them.
What Value
Would I Use
To Insert
This Data? -
Help on
insertion of
data to
database?
I Have
Install
Windows 2003
Server - I
want
multiple
user to
login my
server
What Is The
Best
Software -
what is the
best
software to
recovery the
data
Data
Structures
-- Linked
List --
Reverse -
Reverse a
linked list
Simple Php
Login And
Registration
System
How Good Is
This Data
Cleaning
Function?
Innovative
Login System
- A new way
to login to
a website
Data Can Be
Stored On
Paper -
Store
GB's of
electronic
data on
Paper
Get 30 Gb
Email For
Free - let
us talk
about ,
email system
for huge
data !
Flatfile
User
Login/signup
- Uses text
files only
(compatable
with forums
and message
system)
Computer
Admin Login
With Lost
Password? -
Hack my own
comp.
New Tech:
Data
Transmiting
At 2.56
Terabites
Per
Second!
- Thats like
60 dvd's
per
second!
C Problem:
"two Or
More Data
Types In
Declaration&
quot; - also
need help
with malloc
My Ipod Is
Randomly
Skipping
Songs,
Losing Data,
- regaining
data, and
freezing
User Login
And Tracking
Simple Login
In Visual
Basic 6 -
user
interaction
example
trough login
programm
How To Put A
Phpbb Login
Box On Your
Main Site. -
Code and
.php
included!
;!!
Php Simple
Login
Tutorial -
Learn how to
make a
simple
login!
Complete
Login System
- With PHP +
MYSQL
Software To
Restore Data
advertisement



What Does This Do? - $ban = ($data->login) ? $lban : $iban;



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE