Please I Need Help With Php Session - Webmasters - Nairaland
Nairaland Forum › Science/Technology › Webmasters › Please I Need Help With Php Session (774 Views)
| Please I Need Help With Php Session by internetpo(op): 4:24pm On Mar 27, 2009 |
Please how do i create a session variable that will be used to search a database and display the users profile. |
| Re: Please I Need Help With Php Session by Nobody: 10:59am On Apr 02, 2009 |
$_SESSION['var_name']="seun" so ur sql will look something like select * from users_tbl where where username="$_SESSION['var_name']" |
| Re: Please I Need Help With Php Session by Nobody: 7:10am On Apr 04, 2009 |
Not forgetting to start your page with session_start() and all that. . .i assume you have sorted it all out iight? |
| Re: Please I Need Help With Php Session by nitation(m): 2:07pm On Apr 04, 2009 |
Remember not to leave any white spaces before session_start(); <?php session_start(); |
| Re: Please I Need Help With Php Session by Nobody: 7:35pm On Apr 04, 2009 |
Interesting. . .i never knew space will stop it. . .i mean, i have never tried it before, to put space before it. . .by habit. Mr poster, i hope you are writing down all of these!! |
| Re: Please I Need Help With Php Session by Nobody: 2:20pm On Apr 13, 2009 |
<?php@Nitty, are u saying this is wrong? i guess u meant to say, no output before session usage, output includes white spaces; carriage returns and line feeds and that EXcludes white spaces within ur php codes |
| Re: Please I Need Help With Php Session by charliebiz(m): 5:46pm On Apr 14, 2009 |
wat if they value is unknown that is the session doesn't have a value yet. webdezzi already gave it a value |
| Re: Please I Need Help With Php Session by Nobody: 8:17pm On Apr 15, 2009 |
well, i wonder why you will need a session without a value just like buying a safe with no plans about using it maybe u mean something similar to javascript variable definition var webdezzi; //then use webdezzi later if that is what u mean, then sorry, php does believe in that theory you dont have to declare a variable before using, if you must, then you can initialize it by assigning it to a default value e.g $_SESSION['var_name']=""; //for strings $_SESSION['var_name']=0; //for ints, though you can cast on the fly you can always use isset() to check the existence of any variable including sessions if(isset($_SESSION['var_name'])) {do something} |
Creating An Alumni Site With Php And Mysql • Designing A Site With Php And Oracle Tutorial (Oracle 10G) • Controlling Cpanel With Php Scripts To Create Email, Dbase, Subdomains: • 2 • 3 • 4
What Do U Think Of Being A Weblogger • Ask any question here concerning programming • Any One Ever Hosted With Godaddy.com?