reeena11
reeena11

Reputation: 105

how do i display mysql data in marquee?

i'm trying to use a marquee to display all the data from jobs table , but some how i can't display anything at all although it connects to the database successfully .so how can i display the data using 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>

Upvotes: 0

Views: 1349

Answers (1)

jeroen
jeroen

Reputation: 91744

This is what you do at the start of your marquee:

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

You open a script tag so everything you echo out, ends up inside the script tag and will be interpreted by the browser as javascript. So you will probably see a lot of errors in the console and your text in the source code.

Just remove the opening and closing script tags and you will have yourself a very cool retro marquee :-)

Upvotes: 1

Related Questions