lightpassion Posted March 26, 2011 Share Posted March 26, 2011 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 -------------------------------------------------------------------------------- Quote Link to comment https://forums.phpfreaks.com/topic/231809-i-cant-dis-to-work-am-frustrated/ Share on other sites More sharing options...
ignace Posted March 27, 2011 Share Posted March 27, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/231809-i-cant-dis-to-work-am-frustrated/#findComment-1192796 Share on other sites More sharing options...
lightpassion Posted March 27, 2011 Author Share Posted March 27, 2011 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, '.', ','); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/231809-i-cant-dis-to-work-am-frustrated/#findComment-1192865 Share on other sites More sharing options...
fenway Posted April 1, 2011 Share Posted April 1, 2011 Use code tags next time. Quote Link to comment https://forums.phpfreaks.com/topic/231809-i-cant-dis-to-work-am-frustrated/#findComment-1195695 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.