Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    need help creating member profiles

    Hi, I'm making a website for people to join and i created the registration, login, and logout forms and to test it i have three made up test users and for some reason whenever i log in with each of them and click on the link for their individual profile --> /profile.php?id=... page only shows the first record's information, not what user logged in...how do i fix this?? thanks!

    ps i'm using dreamweaver cs4

  • #2
    New Coder
    Join Date
    Feb 2009
    Posts
    38
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by mfriedman24 View Post
    Hi, I'm making a website for people to join and i created the registration, login, and logout forms and to test it i have three made up test users and for some reason whenever i log in with each of them and click on the link for their individual profile --> /profile.php?id=... page only shows the first record's information, not what user logged in..
    It seems the userid is not passed or recieved properly.and thats why the query is always giving u the first result.
    it would be better if you provide the query or the code where it is getting stucked.

  • #3
    New Coder
    Join Date
    Mar 2009
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is the code on the profile.php page, thanks for the quick response!


    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
    }

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }
    }

    mysql_select_db($database_SH, $SH);
    $query_Recordset1 = "SELECT * FROM Signup";
    $Recordset1 = mysql_query($query_Recordset1, $SH) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);

  • #4
    New Coder
    Join Date
    Feb 2009
    Posts
    38
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by mfriedman24 View Post
    This is the code on the profile.php page, thanks for the quick response!


    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
    }

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }
    }

    mysql_select_db($database_SH, $SH);
    $query_Recordset1 = "SELECT * FROM Signup";
    $Recordset1 = mysql_query($query_Recordset1, $SH) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    you havent recieved the $userid.

    it should be as given below..add first line at top to get the id and replace your query with the query given below
    PHP Code:
    $userid $_REQUEST['id'];
    $query_Recordset1 "SELECT * FROM Signup where usreid = $userid"

  • #5
    New Coder
    Join Date
    Mar 2009
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok i did that but two things: 1) should i put that in the login page and the profile page? and 2) when i did that for the login page i get this error message "Unknown column 'userid' in 'where clause'"

  • #6
    New Coder
    Join Date
    Mar 2009
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    and now it also says unknown T_IF in line 77 (the first line under where i declare $userid)

  • #7
    New Coder
    Join Date
    Feb 2009
    Posts
    38
    Thanks
    0
    Thanked 1 Time in 1 Post
    you need to put those 2 lines in the code which you had provided.

    Basically first line will get the userid which you have passed.i.e
    /profile.php?id=...

    and in the query you had only done "select *" which will get you all the details of all the users.but you wanted to have details of only that user whose id is passed so put that condition
    Code:
    where useridcolumnname = $userid

  • #8
    New Coder
    Join Date
    Mar 2009
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok this is my login page's code:
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
    }

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }
    }

    mysql_select_db($database_SH, $SH);
    $query_Recordset1 = "SELECT * FROM Signup";
    $Recordset1 = mysql_query($query_Recordset1, $SH) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>



    this is the homepage's code that should display user information:

    <?php
    $userid = $_REQUEST['id']
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
    }

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }
    }

    mysql_select_db($database_SH, $SH);
    $query_Recordset1 = "SELECT * FROM Signup where id = $userid";
    $Recordset1 = mysql_query($query_Recordset1, $SH) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>

    and when i test it out, i log in and it gives me this error:
    Parse error: syntax error, unexpected T_IF in /home/socialh1/public_html/home.php on line 77

    line 77 is the line in the homepage's code that is under $userid = $_REQUEST['id']

    what should i do?

  • #9
    New Coder
    Join Date
    Mar 2009
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry i'm really new at this and i'm using dreamweaver


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •