0
こんにちは、私のコードで何が間違っているのか教えてください。私のコードに何の誤りもなく、結果も表示されていないのは分かりません。私のdatabas(mysql) usersdetailsに使用され、もう1つはユーザーのコメントとファイルを保存するために使用されます。セッションとログインphpmysql help
<?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'] . ' </big> <p>');
echo('<div style="text-align: justify;">' . $row['test'] . ' </div>');
echo('<p><span style="font-style: italic;">' . $row['date'] . ' </span>');
}
// When clicked, this link will load this page
// with the joke submission form displayed.
?>
だから基本的にすべて:D – Hailwood
ありがとうjuwin私はあなたの方法を試してみました – test