php - MySQL - cannot order by value -
so want order values in database highest lowest. thing randomly scramble results, meaning puts 100 below 50 in middle , 1 in top.
<?php $con=mysqli_connect("localhost","username","password","table"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $result = mysqli_query($con,"select * playerdata order gold"); while($row = mysqli_fetch_array($result)) { echo $row['username']; echo " " . $row['gold']; $row['unique_id']; echo "<br>"; } mysqli_close($con); ?>
select * playerdata order gold desc
Comments
Post a Comment