PHP Nubsauce Posted June 9, 2008 Share Posted June 9, 2008 My problem is that everything works just fine, but if a referrer has no payment, he doesent show up on the referrers list. Referrers that do have payments, show up just fine. I need a referrer to show up even if they do not have a payment.. Any help would be awesome! I'm pretty sure its me closing with } at the wrong times. But if I mess with the close brackets, things get REALLY REALLY wacked out. If theres no payment, is there a way to put "None", making the referrer still show up? Thanks, Nubsauce. <span class="textDkGrayBold"><strong> <a href="add.php">Add a Referrer</a></strong></span> <br> <br> <table width="68%" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="17%" bgcolor="#66CCCC" class="bold"><strong>Name</strong></td> <td width="17%" bgcolor="#66CCCC" class="bold"><strong>Amount Due </strong></td> <td width="17%" bgcolor="#66CCCC" class="bold"><strong>Last Payment Date</strong></td> <td width="18%" bgcolor="#66CCCC" class="bold"><strong>Last Payment Amount</strong></td> <td width="18%" bgcolor="#66CCCC" class="bold"><strong>Phone</strong></td> <td width="18%" bgcolor="#66CCCC"> </td> </tr> <?php $links = @mysql_query("SELECT * FROM ".$mysql_pretext."_referrers ORDER BY company ASC"); if (!$links) { echo("Error retrieving referrers from the database!<br>Error: " . mysql_error()); exit(); } while ($link = mysql_fetch_array($links)) { $id = $link["ID"]; $firstname = $link["first_name"]; $lastname = $link["last_name"]; $email = $link["email"]; $homephone = $link["home_phone"]; $cellphone = $link["cell_phone"]; $workphone = $link["work_phone"]; ?> <?php $expectedtotal = 0; $realtotal = 0; $links34 = @mysql_query("SELECT * FROM ".$mysql_pretext."_customers WHERE referrer_id = '$id'"); if (!$links34) { echo("Error retrieving projects from the database!<br>Error: " . mysql_error()); exit(); } while ($link = mysql_fetch_array($links34)) { $customerid = $link["ID"]; $clientcompany = $link["company"]; ?> <?php $links33 = @mysql_query("SELECT * FROM ".$mysql_pretext."_customer_payments WHERE customer_id = '$customerid' ORDER BY date DESC"); if (!$links33) { echo("Error retrieving customer payments from the database!<br>Error: " . mysql_error()); exit(); } ?> <?php while ($link = mysql_fetch_array($links33)) { $customerpaymentid = $link["ID"]; $customerid = $link["customer_id"]; $amountreceived = $link["amount_received"]; $paymentdate1 = $link["date"]; $paymentdate = dateconvert($paymentdate1, 2); $realtotal = $realtotal + $amountreceived; $commissions = $amountreceived * 0.1; } ?> <?php $links47 = @mysql_query("SELECT * FROM ".$mysql_pretext."_referrer_payments WHERE referrer_id = '$id' ORDER BY date DESC LIMIT 1"); if (!$links47) { echo("Error retrieving referrer payments from the database!<br>Error: " . mysql_error()); exit(); } while ($link = mysql_fetch_array($links47)) { $paymentid = $link["ID"]; $amountpaid = $link["amount_paid"]; $paymentdate1 = $link["date"]; $paymentdate = dateconvert($paymentdate1, 2); ?> <?php $totalcommissionpaid = 0; $links11 = @mysql_query("SELECT * FROM ".$mysql_pretext."_referrer_payments WHERE referrer_id = '$id' ORDER BY date DESC"); if (!$links11) { echo("Error retrieving referrer payments from the database!<br>Error: " . mysql_error()); exit(); } while ($link = mysql_fetch_array($links11)) { $paymentid2 = $link["ID"]; $amountpaid2 = $link["amount_paid"]; $realrealtotal = $realtotal * 0.1; $realexpectedtotal = $expectedtotal * 0.1; $totalcommissionpaid = $totalcommissionpaid + $amountpaid2; $totalcommissiondue = $realrealtotal - $totalcommissionpaid; } ?> <tr> <td class="text" valign="top"><a href="referrer.php?id=<?php echo($id); ?>"><?php echo($firstname); ?> <?php echo($lastname); ?></a></td> <td class="text" valign="top">$<?php echo(number_format($totalcommissiondue,2)); ?></a></td> <td class="text" valign="top"><font color="#000000" nowrap class="text"> <?php if($paymentdate1 != '0000-00-00'){ echo($paymentdate); } else { echo('None'); } ?> </font></td> <td class="text" valign="top">$<?php echo(number_format($amountpaid, 2)); ?></td> <td class="text" valign="top"> <?php if($homephone != ''){ ?> h: <?php echo($homephone); ?><br> <?php } ?> <?php if($cellphone != ''){ ?> c: <?php echo($cellphone); ?><br> <?php } ?> <?php if($workphone != ''){ ?> w: <?php echo($workphone); ?> </td> <td valign="top" class="text"><div align="center"> <a href="addreferrerpayment.php?id=<?php echo($id); ?>">Record a Payment<br> <br> </a><a href="edit.php?id=<?php echo($id); ?>">edit</a> - <a href="<?php echo($PHP_SELF); ?>?delete=<?php echo($id); ?>" onClick="return confirm('Are you sure you want to delete this referrer?');">delete</a></p> </div></td><?php } } } } ?> </tr> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.