Jump to content

Weird results from database


guymclaren

Recommended Posts

$sqlq="SELECT * FROM Members";
$objRS = mysql_query($sqlq);
$num = mysql_numrows($objRS);
?>

<div id="content">
<div id="contentleft">
<h2>Lede Betaal geskiedenis</h2>
<table>

<?

$i=0;
while ($i < $num) {
$email = mysql_result($objRS,"email");
$name = mysql_result($objRS,"Name");
$sname = mysql_result($objRS,"Surname");
$neename = mysql_result($objRS,"Nee");
$city = mysql_result($objRS,"City");
$reference = mysql_result($objRS,"id");

$sqlm = "SELECT * FROM fees WHERE member = '".$reference."'";
$objRSi = mysql_query($sqlm);
$numi = mysql_numrows($objRSi);

echo "<tr><td>".$name." ".$sname." </td><td>".$neename." </td><td>".$email." </td><td>".$city."</td></tr>"; 

	$j=0;
	while ($j < $numi) {

		$amount = mysql_result($objRSi, "amount");
			$date = mysql_result($objRSi, "Date");
		echo "<tr><td></td><td></td><td align=right>".$date." </td><td align=right> ".$amount."</td></tr>"; 
		$j++;
		}

$i++;
}

?>

 

Gives me this result

 

ede Betaal geskiedenis
10 10 	10 	10 	10
	1 	1

 

I was expecting text, where have I gone wrong?

Link to comment
Share on other sites

I think it should be something like this:

 

$sqlq="SELECT * FROM Members";
$objRS = mysql_query($sqlq);
$num = mysql_numrows($objRS);
$row = mysql_fetch_row($objRS);
list(
?>

<div id="content">
<div id="contentleft">
<h2>Lede Betaal geskiedenis</h2>
<table>

<?

$i=0;
while ($i < $num) {

$email = $row['email'];
$name = $row['Name'];
$sname = $row['Surname'];
$neename = $row['nee'];
$city = $row['city'];
$reference = $row['id'];

$sqlm = "SELECT * FROM fees WHERE member = '".$reference."'";
$objRSi = mysql_query($sqlm);
$numi = mysql_numrows($objRSi);

echo "<tr><td>".$name." ".$sname." </td><td>".$neename." </td><td>".$email." </td><td>".$city."</td></tr>";
      
      $j=0;
      while ($j < $numi) {

         $amount = mysql_result($objRSi, "amount");
          $date = mysql_result($objRSi, "Date");
         echo "<tr><td></td><td></td><td align=right>".$date." </td><td align=right> ".$amount."</td></tr>";
         $j++;
         }

$i++;
}

?>

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.