Jump to content

query not working correctly....!!!!!!!!!!


sanjay_zed

Recommended Posts

i hav some prob while fetching the records. i hav three tables namely jewellers, gs_customer_registration,gs_deposits_trans   

 

For one jeweller , he is having ' n' no of customers, dat customer is depositing money each month (this record is storing in table customerdeposit) .

Now my query is --I need to fetch the customer name which is not paid for current month. while doing am able to do, but is displaying all the months except the current month.

 

                $jid=$_SESSION["user_id"];

 

              $current_month= date("m");

 

                $sql="SELECT *  FROM gs_customer_registration where jew_id='$jid'";

                $result=mysql_query($sql);

 

                $rec=mysql_fetch_assoc($result);

               

              $a=$rec['customer_id'];

 

  $sql1="select * from gs_customer_registration,gs_deposits_trans where gs_deposits_trans.customer_id='$a' ";

 

      $sql2="select * from gs_customer_registration,gs_deposits_trans where gs_deposits_trans.customer_id='$a' and                              gs_deposits_trans.deposited_date not like '%-$current_month-%'";

 

Link to comment
https://forums.phpfreaks.com/topic/252798-query-not-working-correctly/
Share on other sites

  $sql2="select * from gs_customer_registration,gs_deposits_trans where gs_deposits_trans.customer_id='$a' and                              gs_deposits_trans.deposited_date not like '%-$current_month-%'";

 

 

it is displaying all the month except the current month..

I want the customer name who hav not deposited in this current month. i am not getting the proper condition to check on it.

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.