Kryllster Posted May 16, 2007 Share Posted May 16, 2007 I just switched servers, Im running xp with e>novative>wamp whereas before I was running another wamp. Well the problem is I can create the database and create the character info in that db but when I log in apparently the session isnt starting or something cause now the info I want displayed isn't showing up like it did in WAMP5. Im using InnoDB but was wondering if that had anything to do with it??? Thanks In advance, Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/ Share on other sites More sharing options...
radar Posted May 16, 2007 Share Posted May 16, 2007 Are you getting any errors, and do you actually have session_start(); at the beginning of your code before you attempt to set your sessions? Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254164 Share on other sites More sharing options...
Kryllster Posted May 16, 2007 Author Share Posted May 16, 2007 session_start(); $uname = $_SESSION['uname']; $_SESSION['uname'] == $uname; This is at the very start of the page after the <? it worked before so I'm a little confused it says this "Undefined variable on line 4" Hope this helps Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254183 Share on other sites More sharing options...
john010117 Posted May 16, 2007 Share Posted May 16, 2007 Aren't you supposed to have an "if/else" statement on the last line of code that you've posted? "==" are generally in if/else statements... Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254184 Share on other sites More sharing options...
Kryllster Posted May 16, 2007 Author Share Posted May 16, 2007 I just tried to include that in an if statement it gave me a blank page with no warnings or error just blank! Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254190 Share on other sites More sharing options...
radar Posted May 16, 2007 Share Posted May 16, 2007 Yeah definately -- plus if its giving a line 4, i only see 3 lines and so thats obviously not all the code for this... use the [*code] [/*code] commands with both the <?php and ?> tags for syntax highlighting and let us see the code in its entirety. Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254191 Share on other sites More sharing options...
Kryllster Posted May 16, 2007 Author Share Posted May 16, 2007 <?php session_start(); $_SESSION['uname'] == $uname; $uname = $_SESSION['uname']; ?> this is at the top of the pages I think need them sorry about that I didnt know how to do that thanks Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254196 Share on other sites More sharing options...
neel_basu Posted May 16, 2007 Share Posted May 16, 2007 Post the line 4 and Check the tmp folder it would be outside your htdocs folder . There you will find some files with name sess_* check weather there is any files with name ?? EDIT ---------------------------- == is for Comparing = is for assigning Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254198 Share on other sites More sharing options...
radar Posted May 16, 2007 Share Posted May 16, 2007 <?php $session_start(); if (!isset($_SESSION['uname'])) { $uname = "Guest"; } else { $uname = $_SESSION['uname']; } ?> Try that code and let me know what it does... Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254200 Share on other sites More sharing options...
Kryllster Posted May 16, 2007 Author Share Posted May 16, 2007 I'm sorry i am maybe being a little confusing I have change ot around a couple times but here is the ssid in the sessions folder: uname|N; Here is the code for the character sheet <?php session_start(); $uname = $_SESSION['uname']; if ($_SESSION['uname'] == $uname); { include ('config.php'); Sorry about the mess up like I said it worked before thats whats wierd to me!! Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254206 Share on other sites More sharing options...
radar Posted May 16, 2007 Share Posted May 16, 2007 you dont need the ; there... <?php session_start(); $uname = $_SESSION['uname']; if ($_SESSION['uname'] == $uname) { // note the ; is missing include ('config.php'); btw your quote is false for php programming... you may have the biggest imagination in the world but without the knowledge whatever you've imagined will never be a reality. Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254208 Share on other sites More sharing options...
neel_basu Posted May 16, 2007 Share Posted May 16, 2007 uname|N;That means Sessions are working well. Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254212 Share on other sites More sharing options...
Kryllster Posted May 16, 2007 Author Share Posted May 16, 2007 Undefined variable: session_start in Thats what i get from the code by radar Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254214 Share on other sites More sharing options...
radar Posted May 16, 2007 Share Posted May 16, 2007 oh duh -- i see why i put a $ in front of it -- sorry most the stuff ive been doing is in $'s and so i often put a $ in front of a function take the $ off and try it -- or revert back to your code and just remove the ; from that one line and see how it works... Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254215 Share on other sites More sharing options...
Kryllster Posted May 16, 2007 Author Share Posted May 16, 2007 Ok I noticed that and changed it lol now I get a blank page no error or warnings or anything? Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254222 Share on other sites More sharing options...
radar Posted May 16, 2007 Share Posted May 16, 2007 Couldn't tell you why your getting a blank page -- we dont see enough of the code lol... Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254230 Share on other sites More sharing options...
Kryllster Posted May 16, 2007 Author Share Posted May 16, 2007 Ok here is the first original code that worked with WAMP5 (please don't laugh) oh another thing is I am using frames if that would have anything to do with it?? <?php session_start(); $_SESSION['uname'] == $uname; include ('config.php'); $uname = $_SESSION['uname']; // Select data from database $sql="SELECT * FROM $tbl_name WHERE uname='$uname'"; $result=mysql_query($sql); // Put info into array Hopefully while($row=mysql_fetch_assoc($result)) { echo "<html>"; echo "<head>"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"gamestyle.css\" />"; echo "</head>"; echo "<body>"; echo "<center>"; echo $uname; echo "<br>"; echo "<img src=\"images/Gallery/Elf.jpg\" align=\"center\">"; echo "</center>"; echo "<br>"; echo "<img src=\"images/staff.gif\" align=\"center\">"; echo "<br>"; echo "<font color=\"#b22222\">Character Info</font>"; echo "<br>"; echo "<img src=\"images/staff.gif\" align=\"center\">"; echo "<br>"; echo "<small>"; echo "Race: "; echo "<font color=\"#b22222\">"; echo $row['race']; echo "</font>"; echo "<br>"; echo "Class: "; echo "<font color=\"#b22222\">"; echo $row['fclass']; echo "</font>"; echo "<br>"; echo "Level: "; echo "<font color=\"#b22222\">"; echo $row['levl']; echo "</font>"; echo "<br>"; echo "Hit Points: "; echo "<font color=\"#b22222\">"; echo $row['hitp']; echo "</font>"; echo "<br>"; echo "<img src=\"images/staff.gif\" align=\"center\">"; echo "<br>"; echo "</small>"; echo "<font color=\"#b22222\">Inventory</font><br>"; echo "<img src=\"images/staff.gif\" align=\"center\">"; echo "<br>"; echo "<small>"; echo "Armor: "; echo "<font color=\"#b22222\">"; echo $row['armor']; echo "</font>"; echo "<br>"; echo "Weapon: "; echo "<font color=\"#b22222\">"; echo $row['weapon']; echo "</font>"; echo "<br>"; echo "Gold Onhand: "; echo "<font color=\"#b22222\">"; echo $row['onhand']; echo "</font>"; echo "<br>"; echo "Diamonds: "; echo "<font color=\"#b22222\">"; echo $row['diamond']; echo "</font>"; echo "<br>"; echo "Rubies: "; echo "<font color=\"#b22222\">"; echo $row['rubie']; echo "</font>"; echo "<br>"; echo "<img src=\"images/staff.gif\" align=\"center\"><br>"; echo "<a href=\"chat/cdchat.php#bottom\" target=\"_blank\">[ Crimson Chat ]</a><br>"; echo "</small>"; echo "</body>"; echo "</html>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254234 Share on other sites More sharing options...
radar Posted May 16, 2007 Share Posted May 16, 2007 Okay -- try doing it like this... <?php session_start(); if (isset($_SESSION['uname'])) { include ('config.php'); $uname = $_SESSION['uname']; // Select data from database $sql="SELECT * FROM $tbl_name WHERE uname='$uname'"; $result=mysql_query($sql); // Put info into array Hopefully $row=mysql_fetch_assoc($result); echo "<html>"; echo "<head>"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"gamestyle.css\" />"; echo "</head>"; echo "<body>"; echo "<center>"; echo $uname; echo "<br>"; echo "<img src=\"images/Gallery/Elf.jpg\" align=\"center\">"; echo "</center>"; echo "<br>"; echo "<img src=\"images/staff.gif\" align=\"center\">"; echo "<br>"; echo "<font color=\"#b22222\">Character Info</font>"; echo "<br>"; echo "<img src=\"images/staff.gif\" align=\"center\">"; echo "<br>"; echo "<small>"; echo "Race: "; echo "<font color=\"#b22222\">"; echo $row['race']; echo "</font>"; echo "<br>"; echo "Class: "; echo "<font color=\"#b22222\">"; echo $row['fclass']; echo "</font>"; echo "<br>"; echo "Level: "; echo "<font color=\"#b22222\">"; echo $row['levl']; echo "</font>"; echo "<br>"; echo "Hit Points: "; echo "<font color=\"#b22222\">"; echo $row['hitp']; echo "</font>"; echo "<br>"; echo "<img src=\"images/staff.gif\" align=\"center\">"; echo "<br>"; echo "</small>"; echo "<font color=\"#b22222\">Inventory</font><br>"; echo "<img src=\"images/staff.gif\" align=\"center\">"; echo "<br>"; echo "<small>"; echo "Armor: "; echo "<font color=\"#b22222\">"; echo $row['armor']; echo "</font>"; echo "<br>"; echo "Weapon: "; echo "<font color=\"#b22222\">"; echo $row['weapon']; echo "</font>"; echo "<br>"; echo "Gold Onhand: "; echo "<font color=\"#b22222\">"; echo $row['onhand']; echo "</font>"; echo "<br>"; echo "Diamonds: "; echo "<font color=\"#b22222\">"; echo $row['diamond']; echo "</font>"; echo "<br>"; echo "Rubies: "; echo "<font color=\"#b22222\">"; echo $row['rubie']; echo "</font>"; echo "<br>"; echo "<img src=\"images/staff.gif\" align=\"center\"><br>"; echo "<a href=\"chat/cdchat.php#bottom\" target=\"_blank\">[ Crimson Chat ]</a><br>"; echo "</small>"; echo "</body>"; echo "</html>"; } ?> try doing that, might work... Also you might take a look at the smarty templating engine (smarty.php.net) -- works great for complex programs... i wrote a template engine similar to smarty for use on my site (im not using 1 piece of pre-written code)... Smarty makes it so all your logic can be in 1 file,while all your html can be in different files... Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254240 Share on other sites More sharing options...
Kryllster Posted May 16, 2007 Author Share Posted May 16, 2007 Ok just a blank page, well I used Smarty a little when I was working on a project for another person and was really just learning but I got sick and wasnt available for a few months so I never took it any further. Im just wondering why it woks on 1 server and not the other. I do use the CPED method Copy, Paste, Edit or Delete. Lol but I am learning as I go. Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254243 Share on other sites More sharing options...
radar Posted May 16, 2007 Share Posted May 16, 2007 I think i just found the error -- possibly.... or this could be coming from a different part of the frames... $sql="SELECT * FROM $tbl_name WHERE uname='$uname'"; i doubt your table name is $tbl_name and no-where in this code do we have $tbl_name established. unless thats in config, but i doubt it... Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254246 Share on other sites More sharing options...
Kryllster Posted May 16, 2007 Author Share Posted May 16, 2007 Yeah It's in config but you know I have always had problems with e>novative>wamp I installed it cause it was quicker but what I need is some sort of wamp that is a little more flexible I think anyways??? And I would like to eventually write code from scratch myself any good or should I say great beginners sites or docs or tutes i could get pointed to would help as well!! Thanks for all the help btw, Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254251 Share on other sites More sharing options...
radar Posted May 16, 2007 Share Posted May 16, 2007 I dunno only thing i could say it possibly try using xaamp instead -- ive never had any success with using wamp -- i use xaamp -- it runs mysql, apache, and you can choose either php4 or 5... Well you are always welcome at my site (im in the process of programming it myself) -- its all about teaching people how to design graphics, and program and all that good stuff -- the url for it is cetutorials.com -- also try the tutorials on this site, they could come in handy -- though ive never read them i just know they are there... also look into smarty some more -- because it really is a great template engine. Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254261 Share on other sites More sharing options...
Kryllster Posted May 16, 2007 Author Share Posted May 16, 2007 Well I had problems all night with my system so I have a linux server up now just haven't tested it yet. The Way I see it most of the web is Apache nowadays (at least I think so) that this would be better. I got tired of messin with the windows and really the only reason I still am using windows is cause of games. Thanks for all the help. Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254377 Share on other sites More sharing options...
Kryllster Posted May 16, 2007 Author Share Posted May 16, 2007 I just tested it it works fine now Im not sure what the problem is/was but I'm good for now!! Quote Link to comment https://forums.phpfreaks.com/topic/51603-solved-something-wierd/#findComment-254380 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.