0
<?php

mysql_connect("localhost", "Master", "pword");
mysql_select_db("db");

	$official2 = mysql_query("SELECT * FROM Contribute WHERE stack LIKE '%comic%' ORDER BY points DESC")or die (mysql_error());
	while($row = mysql_fetch_array($official2)) {
	$officaluser = $row['username'];
	
	$officalpoints = $row['points'];
	
	
	
	echo "<table><tr><td align='center'><font face='Arial' size='3px' color='#D99C29'><strong><a href='ustack.php?search=$officialuser' style='text-decoration: none'>$officialuser</a></strong></font></td><td align='center'><font face='Arial' size='3px' color='#FFFFFF'><strong>$officialpoints</strong></font></td></tr></table>";

}
?>

the page is coming up blank??!?

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by colweb
0

try as given below with @ sign

@mysql_connect("localhost", "Master", "pword");
@mysql_select_db("db"); 	
$official2 = @mysql_query("SELECT * FROM Contribute WHERE stack LIKE '%comic%' ORDER BY points DESC")OR die (mysql_error());
0
<?php

mysql_connect("localhost", "Master", "pword");
mysql_select_db("db");

	$official2 = mysql_query("SELECT * FROM Contribute WHERE stack LIKE '%comic%' ORDER BY points DESC")or die (mysql_error());
	while($row = mysql_fetch_array($official2)) {
	$officaluser = $row['username'];
	
	$officalpoints = $row['points'];
	
	
	
	echo "<table><tr><td align='center'><font face='Arial' size='3px' color='#D99C29'><strong><a href='ustack.php?search=$officialuser' style='text-decoration: none'>$officialuser</a></strong></font></td><td align='center'><font face='Arial' size='3px' color='#FFFFFF'><strong>$officialpoints</strong></font></td></tr></table>";

}
?>

the page is coming up blank??!?

After a second look at your code, there are a few thing to change. Fist of all, you have the complete table inside the while loop. That means every time the loop executes, a new table is created. So before the while loop you need

echo "<table>";

and after

echo "</table>";

Inside the wile the echo might work if written like this:

echo "<tr><td align='centter'>
    <font face='Arial' size='3px' color='#D99C29'>
    <strong><a href='ustack.php?search=".$officaluser."' style='text-decoration:none'>".$officaluser."</a></strong></font>
</td>
<td align='center'>
    <font face='Arial' size='3px' color='#FFFFFF'>
    <strong>".$officalpoints."</strong></font>
</td>
</tr>

If you don't notice the change, I did place ". and ." around the variables.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.