このコードは、現在ログインしているユーザの詳細が青で強調表示されたテーブルを作成します。これは、$_SESSION['email']
を使用して現在ログインしているユーザーを識別します。PHP/CSS現在ログインしているユーザの詳細をハイライト表示
テーブル構成内では、要素はCSSクラスcurUser
として宣言されます。この.curUser
は、現在ログインしているユーザーを識別し、色付け/強調表示するためにCSSファイルで使用されます。
問題は、現在のユーザーが選択された後に空白行/行が作成されることです。私はかなり問題がPHPテーブルの作成コードであると確信しています。
誰かがこれを見て、問題を指摘してくれますか?現時点では私を逃していますか?
HTML:
</head>
<body>
<h1>Selections</h1>
<?php
require 'configuration.php';
require 'connectTodb.php';
?>
<table border="1" id="parent" >
<tr>
<th>#</th>
<th>Name</th>
<?php
for ($i = 1; $i < 6; $i++) {
print("<th>Week " . $i . "</th>");
}
?>
</tr>
<?php
$sql = "SELECT selections.week,selections.team,users.email,users.name,selections.outcome FROM users,selections WHERE users.email = selections.email ORDER BY name,week";
$result = mysqli_query($connection, $sql);
print mysql_error();
if (!$result) {
die('Could not query:' . mysql_error());
}
$rowId = 0;
$rows = mysqli_fetch_assoc($result);
while ($rows != null) {
print("<tr>");
$rowId++;
$name = $rows["name"];
if ($rows['email'] == $_SESSION['email']) {
print("<td class=" . $curUser . " type='hidden' value=" . $rows['email'] . ">" . $rowId . "</td>");
print("<td class=" . $curUser . "> " . $rows["name"] . "</td>");
while ($rows != null & $name == $rows['name']) {
print("<td class=" . $curUser . "> " . $rows["team"] . "</td>");
$rows = mysqli_fetch_assoc($result);
}
print("</tr>");
} else {
print("<td type='hidden' value=" . $rows['email'] . ">" . $rowId . "</td>");
}
print("<td> " . $rows["name"] . "</td>");
while ($rows != null & $name == $rows['name']) {
print("<td > " . $rows["team"] . "</td>");
$rows = mysqli_fetch_assoc($result);
}
print("</tr>");
}
?>
</table>
<?php
mysqli_close($connection);
?>
</body>
CSS
.curUser, #rowId {
background-color: lightblue;
}
私は[OK]を、それは私が最初にコメントアウト、助け – SumanKalyan