Marquee Issue - Display Entire Database

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 12
Joined: Sun Aug 14, 2016 9:56 am

Wed Apr 18, 2018 3:04 pm

Hey Guys,

I am trying to fix a PHP page that I am coding for my job. Basically the functionality that I am looking for is a Marquee (Yes I understand the Marquee is done away with in HTML5. I haven't learned to use CSS instead yet) function where the names that I have in my database will scroll from bottom to top in the center of the page. I am a teacher and I am trying to set up a point system to display the points that my kids have earned. I have a MySQL database that has a few fields, such as student ID's, Names, etc. I want to connect my database and have the names and associating information scroll up one after the other on my website. I have some code that I found it online but it didi not work correctly. When it displayed, the entire database showed at once and then disappeared instead of scrolling one at a time. Yes I am a newby at this, so please have patience with me. I have searched online for an answer, and have not been able to find one. So I sdecided to try this forum. Any help is greatly appreciated.

Code: Select all


$scrolling="true"; //Define if text is scrolling or Still


// Check connection
if (mysqli_connect_errno())
  echo "Failed to connect to MySQL. Make sure to edit the config.php file: " . mysqli_connect_error();
$result = mysqli_query($con,"SELECT * FROM students ORDER BY studentId ASC ");
while($swap = mysqli_fetch_array($result))
if ($scrolling == "true"){
//Scrolling Text

 <html> <h1 class="marquee"><span><b><?php echo $swap['studentId'];?>  <?php echo $swap['first_name'];?></b><?php echo $swap['last_name']; ?><</html>

<?php }
else { //Not Scrolling Text
echo $swap['studentId'];
<?php echo $swap['last_name'];


Post Reply