Session 会话和登录phpmysql帮助

Session 会话和登录phpmysql帮助,session,login,Session,Login,你好,你能告诉我我的代码有什么问题吗?我不知道我的代码有什么问题,它没有显示错误和结果。我在我的数据库(mysql)中创建了两个表,一个数据库用于用户详细信息,另一个用于保存用户的评论和文件 <?php session_start(); $firstname= $_SESSION['SESS_FIRST_NAME']; print $firstname; $tes=$_SESSION['SESS_MEMBER_ID']; print $tes; ?> &l

你好,你能告诉我我的代码有什么问题吗?我不知道我的代码有什么问题,它没有显示错误和结果。我在我的数据库(mysql)中创建了两个表,一个数据库用于用户详细信息,另一个用于保存用户的评论和文件

<?php

 session_start();

 $firstname= $_SESSION['SESS_FIRST_NAME'];
  print $firstname;
 $tes=$_SESSION['SESS_MEMBER_ID'];
 print $tes;

 ?>




<?php
 // Default page display
// Connect to the database server
  $dbcnx = @mysql_connect('localhost', 'root', '');
  if (!$dbcnx) {
  die( '<p>Unable to connect to the ' .
  'database server at this time.</p>' );
  }
 // Select the jokes database
 if(! @mysql_select_db('tes') ) {
die( '<p>Unable to locate the joke ' .
'database at this time.</p>' );
 }
// If a joke has been submitted,
// add it to the database.
if (isset($_POST['submit'])) {

$name = $_POST['name'];
$test = $_POST['test'];
$sql = "INSERT INTO details SET
userid='$tes',
name='$name',
test='$test',
date=CURDATE()";
if (@mysql_query($sql)) {
echo('<p>Your joke has been added.</p>');
} else {
 echo('<p>Error adding submitted joke: ' .
 mysql_error() . '</p>');
}
}

 echo('<p> Here are all the jokes in our database: </p>');
 // Request the text of all the jokes
 $result = @mysql_query('SELECT * FROM details where userid="1"');

 if (!$result) {
 die('<p>Error performing query: ' .mysql_error() . '</p>');
   }

 // Display the text of each joke in a paragraph
 while ( $row = mysql_fetch_array($result) ) {

echo('<p><big style="color: rgb(204, 0, 0);">' . $row['name'] . '&nbsp;&nbsp;</big>      <p>');
echo('<div style="text-align: justify;">' . $row['test'] . '&nbsp;&nbsp;</div>');
echo('<p><span style="font-style: italic;">' . $row['date'] . '&nbsp;&nbsp;</span>');


}
 // When clicked, this link will load this page
// with the joke submission form displayed.

?>

尝试从正在使用的数据库相关函数的开头删除错误控制运算符at符号(@)。这将抑制来自这些函数的错误。另外,您是否有错误报告

ini_set('display_errors',1);
error_reporting(E_ALL);
你在页面上看到任何文字了吗?例如“以下是我们数据库中的所有笑话:”

我还看到,在引用$row['name']、$row['test']时,您使用的是mysql_fetch_array(),就好像您使用的是mysql_fetch_assoc()