Jump to content

[SOLVED] Query only returning one result?


twilitegxa

Recommended Posts

I changed it to this code, and now it works perfectly:

 

//validate defects
$get_defects = "SELECT * FROM character_defects INNER JOIN scout USING (identity) WHERE scout.id = $_GET[id] ORDER BY defect_id ASC";

$get_defects_res = mysql_query($get_defects) or die (mysql_error());

if (mysql_num_rows($get_defects_res) < 1) {
//invalid table
$display_block .= "<p><em>Invalid table selection.</em></p>";
} else {
//valid table, get info
//That's where we start table
$display_block .= "  
<table cellpadding=3 cellspacing=3 border='0' width='40%' id='stats'>
<tr>
<tr><td colspan='3' id='th'>Character Defects</td></tr>
";
while($row = mysql_fetch_array($get_defects_res)) { //here we start the loop

$defect_id = stripslashes($row['defect_id']);
$desc = $row['desc'];
$bp = stripslashes($row['bp']);

//display defects
$display_block .= "<tr>
<td>$defect_id $desc</td>
<td>$bp BP</td></tr>";
} //here the loop ends

$display_block .="</table>";  //here the table ends

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.