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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.