I Need Help With Creating and Connecting to a Simple Profile Page.. Please Help

Discussion in 'Programming' started by Fat_Man, Feb 10, 2011.

  1. #1
    Okay so I have a problem.. I am trying to link my main user directory page to my member profile page
    Here is the User directory page



    Userdirectory.php

    <?php
    // Connect database.
    $host="localhost"; // Host name.
    $db_user="user";
    $db_password="password";
    $database="data"; // Database name.
    mysql_connect($host,$db_user,$db_password);
    mysql_select_db($database);

    $start=$_GET['start']; // starting value of query

    if(!isset($start)) $start = 0; //if $start is null then assign 0
    $limit=10; // limits of records

    $query="select * from users LIMIT $start,$limit";

    $result=mysql_query($query) or die(mysql_error());

    echo "<h2>PHP Paging</h2>";

    // include("ads_inc/adunits_home.php");
    while($myrows=mysql_fetch_array($result)){

    print "<a href='" . "profile.php?UserId=" . $myrows['UserId'] . "'>".$myrows['codename']."</a><br />";

    if (trim($myrows["UserImage"]) > ' ')
    {
    print "<img src='/members/images/member/" . $myrows["UserImage"] . "' width='75'>";
    }

    else
    {

    print "<img src='/members/images/member/default2.png' width='75'>";

    }
    print "<p>";

    }
    /* Get total number of records */
    $query = "SELECT count(*) as count FROM users";
    $results = mysql_query($query);
    $row = mysql_fetch_array($results);
    $numrows = $row['count'];


    $i=0; //
    $number=1;

    if($start > 0)
    echo "<a href=" . $_SERVER['PHP_SELF'] . "?start=" . ($start - $limit) .
    ">Previous</a>";

    for($i=0;$i < $numrows;$i=$i+$limit){
    if($number <> $eu){
    echo " <a href='".$_SERVER['PHP_SELF']."?start=$i'><font face='Arial' size='2'>$number</font></a>";
    }
    else { echo "<font face='Arial' size='2' color='red'>$number</font>";

    } /// Current page is not displayed as link and given font color red
    $number=$number+1;
    }
    if($numrows > ($start + $limit))
    echo "&nbsp;&nbsp;<a href=\"" . $_SERVER['PHP_SELF'] . "?start=".($start + $limit).">Next</a>";
    ?>

    and my profile page as it stands right now is completely simple because I just want it to connect then I can work with
    it from there. Unfortunately my user results display showing all of the users in my database but
    I cannot get it to connect to a profile.php page



    profile.php


    <?

    session_start();

    include("mysqlconn.php");

    ?>
    <!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>Untitled Document</title>
    </head>

    <body>
    <?php
    $query = "select *from users where UserId='".$_SESSION['UserId']."'";

    $result = mysql_query($query);

    while($rows=mysql_fetch_array($result)){

    $gId = $rows["UserId"];

    $gcode = $rows["codename"];

    $gemail = $rows["UserEmail"];

    $gname = $rows["UserName"];

    $gpass = $rows["UserPass"];

    $gadd = $rows["UserAdd"];

    $gcity = $rows["UserCity"];

    $gzip = $rows["UserZip"];

    $gcon = $rows["UserCountry"];

    $gnl = $rows["NewsLetter"];

    $uImage = $rows["UserImage"];

    }


    ?>

    <?
    echo $codename ;
    ?>


    </body>
    </html>

    As I said I know it's embarrasing but I just want it to pull the name right now as to test it out.

    Can someone please help
     
    Fat_Man, Feb 10, 2011 IP
  2. iamgame

    iamgame Greenhorn

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #2
    What is the error that you are getting?
     
    iamgame, Feb 11, 2011 IP