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
https://forums.phpfreaks.com/topic/231809-i-cant-dis-to-work-am-frustrated/
Share on other sites

Can you post your code? money.Debit, to MySQL this means the same, to PHP Debit and debit are 2 different indices. I also noted INNNER. Add these 2 lines at the start of your script:

 

error_reporting(E_ALL);
ini_set('display_errors', 1);

 

While you are developing.

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, '.', ',');
}
  
?>

 

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.