Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
KrypTarch Posted April 19, 2017 Posted April 19, 2017 As the title says how would i go by doing that, because i set up a php block and tried using it with the custom blocks feature and it does not work right now this is what i haven done in my custom block obviously above is my db details
clearvision Posted April 19, 2017 Posted April 19, 2017 Custom PHP blocks work fine, I'm working on several right now. If you have ANY error in syntax you will get nothing though. If you can check the block with just a print statement to eliminate any other issue, you are then down to your php code being the issue. For instance if that is a double quote at the start of your while echo, you'll get nothing most likely.
KrypTarch Posted April 19, 2017 Author Posted April 19, 2017 $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed to AuXile Framework Highscores Database: " . $conn->connect_error); } $sql = "SELECT name, locker FROM account ORDER BY locker DESC LIMIT 5"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { echo "Name: " . $row["name"]. " - $: " . $row["locker"]. "; } } else { echo ''Error fecthing any players from database.''; } $conn->close();
Recommended Posts
Archived
This topic is now archived and is closed to further replies.