# Whats wrong with my code?

**URL:** <https://forum.kirupa.com/t/whats-wrong-with-my-code/260230>\
**Category:** Uncategorized\
**Created:** [May 13, 2008, 5:37pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-code/260230 "2008-05-13T17:37:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonhardwick](https://avatars.discourse-cdn.com/v4/letter/j/c68b51/32.png) [@jasonhardwick](https://forum.kirupa.com/u/jasonhardwick)\
**Post date:** [May 13, 2008, 5:37pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-code/260230/1 "2008-05-13T17:37:25Z")

</div>

what i am trying to do is create a my account page so you can review and edit your information and i am trying to pull the proper record by using the session “username”

here is the code

```auto

<?
session_start();
if (empty($_SESSION['username'])){
header("location:index1.php");
exit;
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>My Creative Process</title>
<style type="text/css">
<!--
.style1 {color: #666666}
-->
</style>
<link href="/css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style2 {	color: #f73602;
	font-weight: bold;
}
.style3 {
	color: #FFFFFF
}
.style4 {color: #F15A25}
-->
</style>
</head>

<body>
<table width="972" border="0" cellspacing="0" cellpadding="5">
  <tr>
    <td><div align="right">Logged in as: <? echo $_SESSION['username'];?></div></td>
  </tr>
</table>
<table width="972" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#F73602" id="frame">
  <tr bordercolor="#F15A25">
    <td colspan="4"><div align="center">
      <p><img src="/images/header.jpg" width="942" height="84" /></p>
      <table width="902" border="0" cellspacing="0" cellpadding="5">
        <tr>
          <td width="728"><p><span class="style1"><a href="/index.php">home</a> | <a href="/main_forum.php">review</a> | <a href="/create_topic.php">post</a> | <a href="/mindgames.php">mindgames</a> | <a href="/archive.php">archive</a> | <a href="/brainstorm.php">brainstorm</a> | <a href="/my_account.php">my account</a> | <a href="/suggestion_box.php">suggestion box</a></span></p> </td>
          <td colspan="-1"><div align="right">
            <?
  //echo "You've been logged in since" . $_SESSION['time'] . "<br>";
  
  echo '<a href="logout.php">Click here to logout</a>';
  //echo "<br>";
 // echo '<a href="' .$_SERVER['PHP_SELF']. '?action=change"> Change Password</a>';
  ?>
              <?
  include "fns.php";
  $action=$_GET['action'];
  if($action=="change"){
  changepw($_SESSION['username']);
  update($newpass,$_SESSION['username']);
  }else{
  
  }
    ?>
                    </div></td>
        </tr>
      </table>
      <table width="902" border="0" cellspacing="0" cellpadding="5">
        <tr>
          <td width="728" valign="top"><p>
            <?php
include "config.php";
$user=($_SESSION['username']);
$tbl_name="user";
$sql="SELECT * FROM $tbl_name WHERE uname = '$user' ";
$result=mysql_query($sql);
$f_name=$_GET['f_name'];

echo $_SESSION['username'];
echo $f_name;
?>

```

---

<div class="post-metadata">

**Author:** ![jasonhardwick](https://avatars.discourse-cdn.com/v4/letter/j/c68b51/32.png) [@jasonhardwick](https://forum.kirupa.com/u/jasonhardwick)\
**Post date:** [May 13, 2008, 6:42pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-code/260230/2 "2008-05-13T18:42:29Z")

</div>

wow… this forum is dead!

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [May 13, 2008, 6:51pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-code/260230/3 "2008-05-13T18:51:24Z")

</div>

Last I checked none of us were your personal code monkeys’ … and with in the span of an hour from your original post you expect an instant answer. Bad form man, bad form.

---

<div class="post-metadata">

**Author:** ![djheru](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/djheru/32/3190_2.png) [@djheru](https://forum.kirupa.com/u/djheru)\
**Post date:** [May 13, 2008, 8:48pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-code/260230/4 "2008-05-13T20:48:49Z")

</div>

It might help if you actually describe the specific problem that you are having. Also, remember that print\_r is your friend when you are trying to figure things out.
