I dont know why this code will not show any data from the mysql.........................

$query = "SELECT * FROM g_attack WHERE winner ='$username' ORDER BY created ASC LIMIT 10"; 
$row = mysql_query($query) or die("Could not connect to db"); 
while ( $result = mysql_fetch_assoc($row)) { 
$created = $row['created'];
$looser = $row['looser'];
$stolengold = $row['stolengold'];
 
echo '<tr>'; 
echo '<td>'.$created.'</td><td>You won over <b>'.$looser.'</b> and stole <b>'.$stolengold.'</b></td>';
echo '</tr>';

}

the database is connected, it is data in the database, but it just dont wanna get any info from it....

Change row to result on line 2 and swap the two variables on line 3.

you did a silly mistake in your code....
check your line 4,5,6
replace it with

$created = $result['created'];
$looser = $result['looser'];
$stolengold = $result['stolengold'];

So the complete code will be....

$query = "SELECT * FROM g_attack WHERE winner ='$username' ORDER BY created ASC LIMIT 10"; 
$row = mysql_query($query) or die("Could not connect to db"); 
while ( $result = mysql_fetch_assoc($row)) { 
$created = $result['created'];
$looser = $result['looser'];
$stolengold = $result['stolengold'];
 
echo '<tr>'; 
echo '<td>'.$created.'</td><td>You won over <b>'.$looser.'</b> and stole <b>'.$stolengold.'</b></td>';
echo '</tr>';
 
}

PS-If your problem is solved mark the thread as solved

yeah i saw it like 1 hour after i posted it, but really, thanks for help. When you're "wired-in" its easy to write quick and deep but easier to do small mistakes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.