php - 如何在跑马灯中显示 mysql 数据?

标签 php html css mysql marquee

我正在尝试使用选取框来显示作业表中的所有数据,但尽管它已成功连接到数据库,但我无法显示任何内容。那么如何使用选取框显示数据?

    <html>
    <body>
       <div class="box"  STYLE="position:absolute; TOP:110px; LEFT:1100px;height: 470px;width : 200px;padding:10px;" >
  <!-- STYLE="position:absolute; TOP:170px; LEFT:980px;height: 349px;width :360px;" -->
 <u><font size="3" color="white">- Jobs may inters you :</font></u>
 <br>
 <marquee direction="up" scrollamount="2">
  <p id="boxContent">
  <script>
  <?php
  $conn = new Mysqli("localhost", "root", "", "ISNet");
  if($conn->connect_error){
    die("Connection failed:".$conn->connect_error);
  }
  $sql = "SELECT * FROM jobs";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        echo "<br> position - ". $row["position"]. "<br> company- ". $row["company"].
        " <br> address -" . $row["Address"] ."<br> description - " . $row["description"] . " <br> mail -" . $row["mail"] .
         "<br>";
         echo "----------------------------------";
    }
} else {
    echo "0 results";
}
  ?>
  </script></p>
 </marquee>
</div>
</body>
</html>

最佳答案

这是您在选取框开始时所做的:

<marquee direction="up" scrollamount="2">
  <p id="boxContent">
  <script>

您打开一个脚本标签,这样您回显的所有内容都会在脚本标签内结束,并将被浏览器解释为 javascript。因此,您可能会在控制台和源代码中的文本中看到很多错误。

只需删除开头和结尾的脚本标签,您就会拥有一个非常酷的复古选框:-)

关于php - 如何在跑马灯中显示 mysql 数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48625845/

相关文章:

html - 内联 CSS 和移动 CSS 重叠

css - 指定列数并在 CSS 网格中仍然进行换行

php - 在 jquery 中获取假路径

php - laravel中如何在数据库表中只添加一条数据

PHP 类 $_SERVER 变量一个属性

html - 如何让 Vim HTML 语法突出显示来为整个标签着色?

javascript - 图片库中的图片定位

javascript - 以一定 Angular 移动,jquery,animate()?

javascript - 将选择元素放入具有 z-index 位置的 div 到 Highcharts 容器

php - mysql有多少搜索结果