doudu9148 2016-01-22 16:46
浏览 9

如何设置我的PHP代码结果?

I wrote this code and I want to style it with css. I added style to it but same result appears can any body help please .

<p>
<phpcode> 
<?php           
$term = mysql_real_escape_string($_REQUEST['term']);
$servername = "localhost";
$username = "***********";
$password = "***********";
$dbname = "*************";
$conn = new mysqli($servername, $username, $password, $dbname); 
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}   

$sql = "SELECT Install ,  power , RPM FROM SN WHERE serial = '$term'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {

    while($row = $result->fetch_assoc()) {
        echo "serial number: " . $term.'<br>';
        echo "installation: " . $row["Install"].'<br>';
        echo "power: " . $row["power"].'<br>';
        echo "RPM: " . $row["RPM"].'<br>';

    }
} else {
    echo "no result";
}
$conn->close();         
?> 
</phpcode>
</p>
  • 写回答

1条回答 默认 最新

  • dougekui1518 2016-01-22 17:01
    关注
    <style>
        .results div:nth-of-type(1){
            color:red;
            background:blue;
            font-size:3rem;
        }
        .results div:nth-of-type(2){
            color:blue; 
            background:yellow;
            font-size:2rem;
        }
        .results div:nth-of-type(3){
            color:green;
            background:orange;
            font-size:1rem;
        }
        .results div:nth-of-type(4){
            color:orange;
            background:black;
            font-size:0.5rem;   
        }
    </style>
    
    
    
    
        while( $row = $result->fetch_assoc() ) {
            echo "
            <div class='results'>
                <div>serial number:{$term}</div>
                <div>installation:{$row['install']}</div>
                <div>power:{$row['power']}</div>
                <div>rpm:{$row['rpm']}</div>
            </div>";
        }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集