Php Mysql echo,引用语法帮助(echo,if/else)
我的数据库中有两个表: 1.)成员(id、用户名、电子邮件、密码、salt、tier)=原则(如果Bob的层号大于等于seclevel,则echo contents,否则echo访问被拒绝),但老实说,在语法方面修改我在这里要做的事情有点过头了 有人能帮忙吗?下面是get_opwire.php:Php Mysql echo,引用语法帮助(echo,if/else),php,mysql,sql,if-statement,reference,Php,Mysql,Sql,If Statement,Reference,我的数据库中有两个表: 1.)成员(id、用户名、电子邮件、密码、salt、tier)=原则(如果Bob的层号大于等于seclevel,则echo contents,否则echo访问被拒绝),但老实说,在语法方面修改我在这里要做的事情有点过头了 有人能帮忙吗?下面是get_opwire.php: <?php include_once 'functions.php'; include_once 'db_connect.php'; sec_session_start(); if(logi
<?php
include_once 'functions.php';
include_once 'db_connect.php';
sec_session_start();
if(login_check($mysqli) == true) {
$con=mysqli_connect("localhost","mylogin","mypassword","mysqldatabase");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
function getColor($strOption)
{
switch ($strOption)
{
case "Enemy Location":
return "#cbae80";
case "Item Location":
return "#e59350";
case "Another Category etc":
return "#b7aaa4";
}
}
$result = mysqli_query($con,"SELECT opwire.*,members.username FROM opwire
LEFT JOIN members on opwire.userid=members.id order by date DESC");
echo "<table border='1'>
<tr>
<th>Category</th>
<th>Contents</th>
<th>Date/Time</th>
<th>Operative</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td><font size=1 color='".getColor($row['category'])."'> " . $row['category'] . "</font></td>";
echo "<td><font size=1 color=#e4d6b5>" . $row['contents'] . "</font></td>";
echo "<td><font size=1 color=silver>" . $row['date'] . "</font></td>";
echo "<td><font size=1 color=gold>" . $row['username'] . "</font></td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
} else {
echo 'Access to this area requires security clearance. <br/>';
}
?>
垃圾桶里的火箭筒就是一个例子。请不要让它阻止你在这里帮助我。