techker Posted December 21, 2008 Share Posted December 21, 2008 hey guys in my script i used session and when a client logs in it shows his name <? echo $check['name']; ?> i need to make a config page and i whant to do a variable that will eco the username i have tryed this but no success $trainer=$check['name']; Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/ Share on other sites More sharing options...
sKunKbad Posted December 21, 2008 Share Posted December 21, 2008 If you are storing the username in a session, then that is where you will have to look for it: $trainer = $_SESSION['name']; Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720924 Share on other sites More sharing options...
techker Posted December 21, 2008 Author Share Posted December 21, 2008 i have tryed that and it does not work it is in the script that the variable $check is already done i juste need to use it. $trainer=$check['name']; Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720933 Share on other sites More sharing options...
DeanWhitehouse Posted December 21, 2008 Share Posted December 21, 2008 you are forgetting to put session_start(); at the top of each page Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720938 Share on other sites More sharing options...
techker Posted December 21, 2008 Author Share Posted December 21, 2008 im already in a variable. is it possible to include it ? $check['name'] can i even put it in a query?WHERE trainer= Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720941 Share on other sites More sharing options...
trq Posted December 21, 2008 Share Posted December 21, 2008 We need to see more code. Your not being descriptive enough about the actual issue at hand. Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720943 Share on other sites More sharing options...
techker Posted December 21, 2008 Author Share Posted December 21, 2008 see my client is using login manager.in a page there is the includes. so all the variable are alredy done. like this $check =$CheckSecurity->page_check($USERNAME, $PASSWORD,$dbhost,$dbusername,$dbpass,$dbname); so when i do $check['name'] it gives me the client login name. now i need to create a variable that will include the client login name. $documents=Scheck['name'] Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720947 Share on other sites More sharing options...
trq Posted December 21, 2008 Share Posted December 21, 2008 so when i do $check['name'] it gives me the client login name. now i need to create a variable that will include the client login name. According to the information you just provided $check['name'] holds your users login name. So what exactly is the problem? Again I say, you need to be more descriptive. Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720951 Share on other sites More sharing options...
DeanWhitehouse Posted December 21, 2008 Share Posted December 21, 2008 Agreed, you aren't asking a question. :s ??? Make sure the page with the var $check is included on the same page where you want to create the new var. Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720952 Share on other sites More sharing options...
techker Posted December 21, 2008 Author Share Posted December 21, 2008 ok..if i can't find the original $check var..then i want to use it.Can i intergrate it then? $check['name'] in another variable that i can make? and in a query ? $fileSQL=" SELECT * FROM `trainers_clients` WHERE `trainer` = $check['name'] ////here LIMIT 0 , 30 "; $fileLIST=mysql_query($fileSQL); Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720956 Share on other sites More sharing options...
DeanWhitehouse Posted December 21, 2008 Share Posted December 21, 2008 What do you mean can't find? Is it located in the script that you are using Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720957 Share on other sites More sharing options...
techker Posted December 21, 2008 Author Share Posted December 21, 2008 ya but his script is very complicated and secure along with messy.. that is why i don't want to wast time looking for it.. Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720960 Share on other sites More sharing options...
trq Posted December 21, 2008 Share Posted December 21, 2008 Your making no sense. Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720961 Share on other sites More sharing options...
techker Posted December 21, 2008 Author Share Posted December 21, 2008 ok can i include this $check['name']in a query??? Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720962 Share on other sites More sharing options...
DeanWhitehouse Posted December 21, 2008 Share Posted December 21, 2008 Try it Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720967 Share on other sites More sharing options...
trq Posted December 21, 2008 Share Posted December 21, 2008 ok can i include this $check['name']in a query??? Of course, any variable can be included into a query. A query is a string like any other. Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720968 Share on other sites More sharing options...
techker Posted December 21, 2008 Author Share Posted December 21, 2008 ok so i know we can but is there any links or name i can google on how to ???that was my mane question. Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720969 Share on other sites More sharing options...
trq Posted December 21, 2008 Share Posted December 21, 2008 All you need do is concatinate it into your query. eg; $sql = "SELECT * FROM foo WHERE username = '" . $check['name'] ."'"; Or imbed it directly within a double quoted string.... $sql = "SELECT * FROM foo WHERE username = '{$check['name']}'"; Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720972 Share on other sites More sharing options...
techker Posted December 21, 2008 Author Share Posted December 21, 2008 All you need do is concatinate it into your query. eg; $sql = "SELECT * FROM foo WHERE username = '" . $check['name'] ."'"; Or imbed it directly within a double quoted string.... $sql = "SELECT * FROM foo WHERE username = '{$check['name']}'"; thxclose but no cigar.. " . $check['name'] ." i forgot the"'" what is this called so i can can study on this? Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720974 Share on other sites More sharing options...
DeanWhitehouse Posted December 21, 2008 Share Posted December 21, 2008 All you need do is concatinate it into your query. eg; Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720975 Share on other sites More sharing options...
techker Posted December 21, 2008 Author Share Posted December 21, 2008 thx! Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720980 Share on other sites More sharing options...
xtopolis Posted December 21, 2008 Share Posted December 21, 2008 concatenate Quote Link to comment https://forums.phpfreaks.com/topic/137935-variable/#findComment-720981 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.