Please Help Me With These Php Questions - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Please Help Me With These Php Questions (1335 Views)
| Please Help Me With These Php Questions by cr80vity(op): 9:31pm On Jan 20, 2016 |
pls help me wt ds simple questions...I.actually dnt understand dem... what does. echo<<<_END, and _END means.... secondly, wats d essence or importance of $_SESSION thanks in anticipation my boss.... |
| Re: Please Help Me With These Php Questions by hexy40: 9:56pm On Jan 20, 2016 |
The essence SESSION: When you create a log in page, some of the detail(eg user name) is set as session. This enables the other pages to prevent those that are not loged in from assessing a page. Ie if not for session, you will have to log in on each page. as for "echo<<<_END'....it just comments out every thing after, I have no Idea of its essence |
| Re: Please Help Me With These Php Questions by cr80vity(op): 10:19pm On Jan 20, 2016 |
hexy40:thanks bro but if dere s sth like $error = invalid username $_SESSION['error'] = $error ...what is d person tryin to do |
| Re: Please Help Me With These Php Questions by Emperoo: 10:42pm On Jan 20, 2016 |
cr80vity:Since question on session is answered, echo _____end , is used when you want to write or include html in a php file, example echo"html code here"; you end echo with "; . |
| Re: Please Help Me With These Php Questions by hexy40: 11:57pm On Jan 20, 2016 |
cr80vity:Thinking of how to put the answer to your question in English....... The person is trying to set the session "error",giving it a value "invalid username". When you insert an invalid username into the log in area, the error session will be set to " invalid username" instead of may be setting the username as session . "invalid username" will now be echoed back to the user.... it depends on how the programmer wants to handle the situation |
| Re: Please Help Me With These Php Questions by DonSegmond(m): 1:56am On Jan 21, 2016 |
The <<< syntax is a carry over from other unix languages. it allows one to have a string that spans multiple lines, in php it's called heredocs. _END is just an arbitary marker and could be anything. I usually use _EOF_ for strings or _SQL_ if it's a long sql statement. You can read more about it here. http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc |
Post Your PHP Questions Here • 2 • 3 • 4
Fellow Coder Need Help O • Are You Around Lekki, Ikoyi, Victoria Island, Eti-Osa and Environment? • Excel Database