You are not logged in.


Forum database was corrupt and an old backup was restored as temporary replacement. Registrations closed until the database is recovered. Please ask questions using the Contact form

#1 31-07-2014 19:41:52

Registered: 31-07-2014
Posts: 1

PHP - SQL in Tiles?!


i'm trying to echo the results of a MySQLi query in a tile...
But it doesn't work. When I do this and I refresh the page, the whole page disappears...

Can you help me out?

This is my query:

$select = $DB->query("SELECT COUNT(*) FROM users WHERE rank = '1'");

How can i echo the result of this query in a tile?

Thanks in advance!

Last edited by Explore (31-07-2014 19:42:04)


#2 31-07-2014 22:10:53

Registered: 10-03-2013
Posts: 897

Re: PHP - SQL in Tiles?!

There are many ways to do that. The main idea is to prepare the content of the tile in a variable and then use the variable. For example in tiles.php:

$select = $DB->query("SELECT COUNT(*) FROM users WHERE rank = '1'");
$content = "";
while($row = $select->fetch_assoc()){
    $content .= $row['username'] .' ';
$tile[] = array("group"=>0, "x"=>........., "text"=>$content);

If you get a blank page (no tiles), it means that there is an error somewhere.


Board footer

Powered by FluxBB