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
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.

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.