Jump to content

Recommended Posts

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,

Link to comment
https://forums.phpfreaks.com/topic/51603-solved-something-wierd/
Share on other sites

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!!

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.

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>";
}
?>

 

 

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...

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.

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...

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,

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.