MySQL Forums
Forum List  »  PHP

Simple Question on SQL And PHP
Posted by: Ranjan Raj Shrestha
Date: May 28, 2018 02:26AM

Am using this code to display the result of my SQL Table Columns

But I want some kind of increment effect before displaying the value of the column.

For example, if the table column has a value of 100
Then before displaying 100, I want it fast increment effect going on from 1 up to 100.


If the table column has a value of 20
Then before displaying 20, I want it fast increment effect going on from 1 up to 20.


<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
$link = mysqli_connect("localhost", "root", "", "demo");

// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}

// Attempt select query execution
$sql = "SELECT * FROM test";
if($result = mysqli_query($link, $sql)){
if(mysqli_num_rows($result) > 0){
echo "<table>";
echo "<tr>";

echo "<th>results</th>";

echo "</tr>";
while($row = mysqli_fetch_array($result)){
echo "<tr>";

echo "<td>" . $row['my_column'] . "</td>";

echo "</tr>";
}
echo "</table>";
// Free result set
mysqli_free_result($result);
} else{
echo "No records matching your query were found.";
}
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}

// Close connection
mysqli_close($link);
?>

Options: ReplyQuote


Subject
Written By
Posted
Simple Question on SQL And PHP
May 28, 2018 02:26AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.