Loading ...
Sorry, an error occurred while loading the content.

Re: mySQL Query with PHP variable is not working

Expand Messages
  • ymnoor21
    Azhar, Can you please generate the exact error that you got initially before posting the problem here. Pardon me, I have doubts about your explanation of not
    Message 1 of 10 , Aug 1, 2011
    • 0 Attachment
      Azhar,
      Can you please generate the exact error that you got initially before posting the problem here. Pardon me, I have doubts about your explanation of not having those variables in a class. And i hope that you understand, everyone who has answered your question has the right to know your problem and solution clearly, so that they can be careful about it. :D

      So can you please have it posted here anytime? I am really curious about it.

      Thanks
      Yamin

      --- In phpexperts@yahoogroups.com, "azhar" <eng.azharul@...> wrote:
      >
      >
      > Thanx to everybody. I have solved my problem. I wrote the query in a class. but $from_date and $to_date was out of class.
      >
    • Anjan Bhowmik
      Well Yamin vai, me too :D But since Azhar vai said that the problem is solved, so i didn t ask. Besides, a problem posting should always contain enough
      Message 2 of 10 , Aug 1, 2011
      • 0 Attachment
        Well Yamin vai, me too :D

        But since Azhar vai said that the problem is solved, so i didn't ask. Besides, a problem posting should always contain enough information so a solution can be suggested as accurately as possible.

        On Mon, Aug 1, 2011 at 10:19 PM, ymnoor21 <ymnoor21@...> wrote:
         



        Azhar,
        Can you please generate the exact error that you got initially before posting the problem here. Pardon me, I have doubts about your explanation of not having those variables in a class. And i hope that you understand, everyone who has answered your question has the right to know your problem and solution clearly, so that they can be careful about it. :D

        So can you please have it posted here anytime? I am really curious about it.

        Thanks
        Yamin

        --- In phpexperts@yahoogroups.com, "azhar" <eng.azharul@...> wrote:
        >
        >
        > Thanx to everybody. I have solved my problem. I wrote the query in a class. but $from_date and $to_date was out of class.
        >




        --
        Anjan Bhowmik
        Freelance Software & Web Developer
        M : +880 - 1670 - 556419
        E : anjan011@...info@...
        Site: http://www.onlyfreelancer.com/ - Only for Freelancer's!

      • azhar
        ok, this was my problem---
        Message 3 of 10 , Aug 1, 2011
        • 0 Attachment
          ok, this was my problem---

          <?php
          $from_date=$_POST['from_year']."-".$_POST['from_month']."-".$_POST['from_day'];
          $to_date=$_POST['to_year']."-".$_POST['to_month']."-".$_POST['to_day'];


          include('db_variable.php');

          class total_summary{

          var $total_payment;

          public function msa_payment(){
          $query=mysql_query("select SUM(payment) as totalPayment from msa_payment WHERE date BETWEEN '$from_date' AND '$to_date'");
          $row=mysql_fetch_array($query);

          echo $this->total_payment=$row['totalPayment'];

          }
          }
        • Saiful Islam
          Dear Azar vai, Plz try this $query=mysql_query( select SUM(payment) as totalPayment from msa_payment WHERE date BETWEEN .$from_date. AND .$to_date. );
          Message 4 of 10 , Aug 1, 2011
          • 0 Attachment
            Dear Azar vai,

            Plz try this

            $query=mysql_query("select SUM(payment) as totalPayment from msa_payment WHERE date BETWEEN '".$from_date."' AND '".$to_date."'");


            single cote  double cote dot $variable dot double cote single cote => '".$variable."'
            --
            Saiful Islam
            Gazipur, Bangladesh
            http://saifulbd.com/



            On Tue, Aug 2, 2011 at 11:06 AM, azhar <eng.azharul@...> wrote:
             

            ok, this was my problem---

            <?php
            $from_date=$_POST['from_year']."-".$_POST['from_month']."-".$_POST['from_day'];
            $to_date=$_POST['to_year']."-".$_POST['to_month']."-".$_POST['to_day'];

            include('db_variable.php');

            class total_summary{

            var $total_payment;

            public function msa_payment(){
            $query=mysql_query("select SUM(payment) as totalPayment from msa_payment WHERE date BETWEEN '$from_date' AND '$to_date'");
            $row=mysql_fetch_array($query);

            echo $this->total_payment=$row['totalPayment'];

            }
            }


          Your message has been successfully submitted and would be delivered to recipients shortly.