Results 1 to 4 of 4

Thread: Help a beginner

  1. #1
    Join Date
    Sep 2012
    Posts
    2

    Help a beginner

    Howzit

    I have been browsing the site and found quite a few helpful scripts which I played around with, however I have not been able to find what I need.

    I am trying to write a report which I think includes more than just PHP.

    I need to build a report where a user can select two dates,so one of those fancy calendar pop up thingys, and once done, will need to reference a mysql database which will then show those records between those dates.

    Eg, I choose between 10-08-2012 and 20-09-2012,when I click submit or search it will then search the respective 'datecolumn' in table a,match up 'id_column' in table a to 'id_column' in table b and show the 'account_number' from table b which corresponds to the date/s selected from the date prompts mentioned earlier.

    If I am not making sense please say so.

    If I need to build more than one page I will do so,I have been struggling with this for a week now,might be easy for others but being inexperienced I wouldnt know where to start.

    I would imagine I need to use more than one language here.
    I think a plan on what to use and how each one connects would be needed, but I dont know how to go about it.

    Any help will be greatly appreciated.

    Cheers
    Harry

  2. #2
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    998
    You can get a popup date checker here Matt Kruse

    As you will soon learn, part of the popup is javascript, and part is php.

    Your initial page will be a form, with the date fields and whatever other fields your application needs. The action= of the form is the second script that processes the input data, and displays the results.

  3. #3
    Join Date
    Sep 2012
    Posts
    2
    Thanks kitaman

    I gave the pop up so far, I just cant get the correct data to show. I also have the query to show the fields I need, but it shows ALL the info, not just what I need. If you could help me split the script I would really appreciate that. I dont want the piechart, that was just a script I copied from the web for the pop up which works fine.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
    
      <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
     <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
      <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript"
      src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart','table','piechart']}]}">
    </script>
    
     <script type="text/javascript">
    
    
    google.setOnLoadCallback(pieChart);
    
    
    function pieChart() {
          var startdate  = "";
          var enddate  =  "";
             if ($("#datepicker").hasClass('hasDatepicker')) {
                startdate  = $("#datepicker").datepicker('getDate');
                 }
               if ($("#datepicker2").hasClass('hasDatepicker')) {
               enddate  = $("#datepicker2").datepicker('getDate');
                }
    
          var pieJsonData = $.ajax({
              url: "overall_ban_pos_pie_date.php?startdate=" + startdate + "&amp;enddate=" + enddate,
              dataType:"json",
              async: false
              }).responseText;
    
    
    
    
    
    
    
    }
      </script>
    
      <script type="text/javascript">
    
      $(document).ready(function() {
        $("#datepicker").datepicker({dateFormat: "yy-mm-dd"});
      });
    
      $(document).ready(function() {
        $("#datepicker2").datepicker({dateFormat: "yy-mm-dd"});
      });
    
    
      $("#pieChart").click(function(e) {
        e.preventDefault();
      });
      </script>
    
    
    
    </head>
    <body style="font-size:62.5%;">
    
      <form action="test_connectdb.php" method="post">
    
    Start Date: <input type="text" name="startdate" id="datepicker"/>
    End Date: <input type="text" name="enddate" id="datepicker2"/>
    
    <input type="submit"  id="date"/>
    
    </form>
    <div id="pie_div"></div>     
    </body>
    <?php	 
    
    
     $con = mysql_connect("localhost:33307","root","sqlcoke");
     if (!$con)
       {
       die('Could not connect: ' . mysql_error());
       }
    
    mysql_select_db("leonetcrm", $con);
     
    $result = mysql_query("SELECT vtiger_account.accountid, vtiger_crmentity.crmid, vtiger_account.account_no, vtiger_crmentity.createdtime
    FROM leonetcrm.vtiger_account
    INNER JOIN leonetcrm.vtiger_crmentity
    ON vtiger_account.accountid=vtiger_crmentity.crmid
    WHERE vtiger_crmentity.createdtime ");
    echo "<table border='5'>
     <tr>
     <th>Account ID</th>
     <th>Account Number</th>
     <th>CRMID</th>
     <th>Createdtime</th>
     </tr>";
     while($row = mysql_fetch($result))
       {
       echo "<tr>";
       echo "<td>" . $row['accountid'] . "</td>";
       echo "<td>" . $row['account_no'] . "</td>";
       echo "<td>" . $row['crmid'] . "</td>";
        echo "<td>" . $row['createdtime'] . "</td>";
       echo "</tr>";
       }
     echo "</table>";
     
    mysql_close($con);
     ?>
    
    
    
    
    
    </html>
    That is pop up and has the data query in it.
    Code:
    <html>
      <body>
    
        Data selected between <?php echo $_POST["startdate"]; ?><br />
        and <?php echo $_POST["enddate"]; ?> is as follows:
    
    
    
      </body>
    </html>

    And that is the secnd page being referenced.

    Any help will be greatly appreciated.

    Thanks

  4. #4
    Join Date
    Sep 2012
    Posts
    21
    Quote Originally Posted by Dirty Harry View Post
    Thanks kitaman

    I gave the pop up so far, I just cant get the correct data to show. I also have the query to show the fields I need, but it shows ALL the info, not just what I need. If you could help me split the script I would really appreciate that. I dont want the piechart, that was just a script I copied from the web for the pop up which works fine.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
    
      <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
     <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
      <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript"
      src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart','table','piechart']}]}">
    </script>
    
     <script type="text/javascript">
    
    
    google.setOnLoadCallback(pieChart);
    
    
    function pieChart() {
          var startdate  = "";
          var enddate  =  "";
             if ($("#datepicker").hasClass('hasDatepicker')) {
                startdate  = $("#datepicker").datepicker('getDate');
                 }
               if ($("#datepicker2").hasClass('hasDatepicker')) {
               enddate  = $("#datepicker2").datepicker('getDate');
                }
    
          var pieJsonData = $.ajax({
              url: "overall_ban_pos_pie_date.php?startdate=" + startdate + "&amp;enddate=" + enddate,
              dataType:"json",
              async: false
              }).responseText;
    
    
    
    
    
    
    
    }
      </script>
    
      <script type="text/javascript">
    
      $(document).ready(function() {
        $("#datepicker").datepicker({dateFormat: "yy-mm-dd"});
      });
    
      $(document).ready(function() {
        $("#datepicker2").datepicker({dateFormat: "yy-mm-dd"});
      });
    
    
      $("#pieChart").click(function(e) {
        e.preventDefault();
      });
      </script>
    
    
    
    </head>
    <body style="font-size:62.5%;">
    
      <form action="test_connectdb.php" method="post">
    
    Start Date: <input type="text" name="startdate" id="datepicker"/>
    End Date: <input type="text" name="enddate" id="datepicker2"/>
    
    <input type="submit"  id="date"/>
    
    </form>
    <div id="pie_div"></div>     
    </body>
    <?php	 
    
    
     $con = mysql_connect("localhost:33307","root","sqlcoke");
     if (!$con)
       {
       die('Could not connect: ' . mysql_error());
       }
    
    mysql_select_db("leonetcrm", $con);
     
    $result = mysql_query("SELECT vtiger_account.accountid, vtiger_crmentity.crmid, vtiger_account.account_no, vtiger_crmentity.createdtime
    FROM leonetcrm.vtiger_account
    INNER JOIN leonetcrm.vtiger_crmentity
    ON vtiger_account.accountid=vtiger_crmentity.crmid
    WHERE vtiger_crmentity.createdtime ");
    echo "<table border='5'>
     <tr>
     <th>Account ID</th>
     <th>Account Number</th>
     <th>CRMID</th>
     <th>Createdtime</th>
     </tr>";
     while($row = mysql_fetch($result))
       {
       echo "<tr>";
       echo "<td>" . $row['accountid'] . "</td>";
       echo "<td>" . $row['account_no'] . "</td>";
       echo "<td>" . $row['crmid'] . "</td>";
        echo "<td>" . $row['createdtime'] . "</td>";
       echo "</tr>";
       }
     echo "</table>";
     
    mysql_close($con);
     ?>
    
    
    
    
    
    </html>
    That is pop up and has the data query in it.
    Code:
    <html>
      <body>
    
        Data selected between <?php echo $_POST["startdate"]; ?><br />
        and <?php echo $_POST["enddate"]; ?> is as follows:
    
    
    
      </body>
    </html>

    And that is the secnd page being referenced.

    Any help will be greatly appreciated.

    Thanks
    Good sharing,..i also really searching this..thanks for your answer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •