If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > Help a beginner

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
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
Reply With Quote
  #2 (permalink)  
Old
Programming since 1BC
 
Join Date: Sep 2009
Location: Ontario
Posts: 981
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.
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On