在php中通过ID显示用户配置文件数据

时间:2015-08-24 05:21:09

标签: php mysql user-interface phpmyadmin

我已经设置了整个SQL数据库。

个人资料页面已经有效,但现在它只显示登录人员的个人资料信息。

我想设置它以便它是profile.php?ID = 1所以任何人都可以查看数据库中的任何配置文件。

我尝试了几个不同的教程,并在这里查看了给别人的答案,但我仍然无法让它工作。我被卡住了。

 <?php
session_start();
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;
}
}

$colname_Recordset1 = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_Recordset1 = $_SESSION['MM_Username'];
}
mysql_select_db($database_login_form, $login_form);
$query_Recordset1 = sprintf("SELECT * FROM users WHERE username = %s", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $login_form) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

    include 'logout_script.php';
?>

2 个答案:

答案 0 :(得分:1)

尝试以下代码。我注意到了重要的部分:

$ ./kbox3/bin/kbox_shell
fakechroot: dlopen: undefined symbol: dlopen

答案 1 :(得分:0)

我能够通过将代码从MM_Username更改为id来解决此问题,并且能够从那里插入适当的详细信息。谢谢!