Jump to content

Results not showing after first one


tjverge

Recommended Posts

I am working on building a code that will check the results returned from and xml pull to see if they match the database and print back pass or fail on the screen, it works for the first result but then fails to display anything else. any help on where I went wrong would be helpful.

 

<?php
function pass($name, $level)
{
$sql1 = "SELECT * FROM `reqskills` WHERE `level` > 0 and `name` = '$name'";
$result1 = mysql_query($sql1);
while($row1 = mysql_fetch_array($result1))
{
if($level >= $row1['level'])
{
echo "Pass";
}
Else
{
echo "Fail";
}
}
}

$API = "address removed";
$xml = simplexml_load_file($API);
$sql = "SELECT * FROM `reqskills` WHERE `level` > 0";
$result = mysql_query($sql);
echo "<table width=100%";
echo "<tr><td>Skill</td><td>Level</td><td>Pass</td></tr>";
while($row = mysql_fetch_array($result))
{
?>
<tr>
<td><?php echo $row['name'] ?></td>
<td><?php echo $row['level'] ?></td>
<td><?php 
foreach ($xml->result->rowset[0] as $value)
{
$typeID = $value['typeID'];	
$sql = "select * from `invTypes` WHERE `typeID` = $typeID";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result))
{
echo pass($row['typeName'],$value['level']); 
}}

echo "</td></tr>";

}
echo"</table>";
?>

Link to comment
https://forums.phpfreaks.com/topic/233921-results-not-showing-after-first-one/
Share on other sites

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.