Jump to content

i cant dis to work am frustrated!


lightpassion

Recommended Posts

i have an sql statement which has been given me sleepless nights. the staments is suppose to pull records but it pulls the records and omits the debit detail

 

this is the code

:SELECT users.username,users.account,users.amount,money.credit,money.Debit,money.date

FROM users INNNER JOIN money

ON users.username = money.username

WHERE users.username = '$username'"

 

pls i need someone to help me with it or am i doing sometin wrong here

 

--------------------------------------------------------------------------------

 

 

Link to comment
Share on other sites

this is my code  i edited the code but its still not displaying a column

 

<?
include("admin/include/session.php");
  	  
   function displayUsers($username){
   global $database;
   $q = "SELECT users.username,users.account,users.amount,money.credit,money.debit,money.date
FROM users INNER JOIN money
ON users.username = money.username
WHERE users.username = '$username'";


   $result = $database->query($q);
   /* Error occurred, return given name by default */
   $num_rows = mysql_numrows($result);
   if(!$result || ($num_rows < 0)){
      echo "Error displaying info";
      return;
   }
   if($num_rows == 0){
      echo "Database table empty";
      return;
   }
   /* Display table contents */
   
   
  echo "<table align=\"center\" border=\"1\" cellspacing=\"1\" cellpadding=\"3\">\n";
   echo "<tr><td scope=\"col\" style=\"width:195px;\" align=\"center\"><b>Account no.</b></td><td scope=\"col\" align=\"center\"><b>Credit</b></td><td scope=\"col\" align=\"center\"><b>Debit</b></td><td scope=\"col\" align=\"center\"><b>Transaction Date</b></td></tr>\n";
   for($i=0; $i<$num_rows; $i++){
       $uacc  = mysql_result($result,$i,"account");
      $uclient = mysql_result($result,$i,"credit");
      $debt  = mysql_result($result,$i,"debit");
      $curr   = mysql_result($result,$i,"date");
  $amount   = mysql_result($result,$i,"amount");
      
      echo "<tr><td style=\"width:195px;\">$uacc</div></td><td align='center'>$uclient</td><td align='center'><font color=red>$debt</font></td><td style=\"width:100px;\">$curr</td></tr>\n";
  

   }
   echo "</table><br>\n";
    echo number_format($amount, 2, '.', ',');
}
  
?>

 

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.