Jump to content

geo3d

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

geo3d's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi folks Need some help with syntax to delete records from my postgresql database. Delete condition is 3 years from date of entry. Delete FROM table WHERE date_entered=DATE_SUB(CURDATE(),INTERVAL 3 YEARS)
  2. Sorry for the confusion and thanks for the replies; To be more clear; I have a calendar input item that a user clicks and gives me a date (the field is called DATE OF REPORT); the result example is 03/21/10. I have a hidden field (called Month - which feeds a chart program). The Month field result needs to be in Cleartext; example March. So my question is how can I pull the first 2 characters from DATE OF REPORT result and post to MONTH field in cleartext? Again, I can't use monthname(current_date) because users might be inputting DATE OF REPORT from a previous month(s). I hope this more clear and thanks again for the replies. I've attached a screenshot of my form. [attachment deleted by admin]
  3. Hi folks, Looking for some help regarding syntax to place month name text to one field based on a date field. Was thinking an elseif statement would work here (i'm always open to better suggestions); note: I can't use monthname(current_date) because my date field is a date of report field that a user may input the date of report for a report last name etc; problem with the use of the wildcard? <?php $d=('DATE'); if($d =='01/%') echo "January"; elseif($d=='02/%') echo "February"; elseif($d=='03/%') echo "March"; elseif($d=='04/%') echo "March"; elseif($d=='05/%') echo "May"; ?>
  4. Problem has been resolved. I did 'Mark Solved'. Thanks agian.
  5. Sorry its the structure of this phpmyedit class table that is confusing me. Since it's all generated based on table; a view source of the webpage on clicking ADD does reflect this form syntax but I don't see where, in this code here, it addresses my problem at all - which is why I sending everything else; if this doesn't help I'll see if I can't the creators of phpmyedit to expand on my problem - and I thank you in advance for taking the time. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Charts PD</title> <style type="text/css"> hr.pme-hr { border: 0px solid; padding: 0px; margin: 0px; border-top-width: 1px; height: 1px; } table.pme-main { border: #004d9c 1px solid; border-collapse: collapse; border-spacing: 0px; width: 100%; } table.pme-navigation { border: #004d9c 0px solid; border-collapse: collapse; border-spacing: 0px; width: 100%; } td.pme-navigation-0, td.pme-navigation-1 { white-space: nowrap; } th.pme-header { border: #004d9c 1px solid; padding: 4px; background: #add8e6; } td.pme-key-0, td.pme-value-0, td.pme-help-0, td.pme-navigation-0, td.pme-cell-0, td.pme-key-1, td.pme-value-1, td.pme-help-0, td.pme-navigation-1, td.pme-cell-1, td.pme-sortinfo, td.pme-filter { border: #004d9c 1px solid; padding: 3px; } td.pme-buttons { text-align: left; } td.pme-message { text-align: center; } td.pme-stats { text-align: left; } </style> </head> <body> <h3>Data Records</h3> <form class="pme-form" method="post" action="dar-test.php" name="PME_sys_form"> <input type="hidden" name="PME_sys_sfn[0]" value="3" /> <input type="hidden" name="PME_sys_fl" value="0" /> <input type="hidden" name="PME_sys_qfn" value="" /> <input type="hidden" name="PME_sys_fm" value="0" /> <table class="pme-main" summary="data"> <tr class="pme-header"> <th class="pme-header">NAME</th> <th class="pme-header">BADGE</th> <th class="pme-header">TEAM</th> <th class="pme-header">DATE OF REPORT</th> <th class="pme-header"><a class="pme-header" href="dar-test.php?PME_sys_fm=0&PME_sys_fl=0&PME_sys_qfn=&PME_sys_sfn[0]=5&PME_sys_sfn[1]=3">MONTH</a></th> <th class="pme-header"><a class="pme-header" href="dar-test.php?PME_sys_fm=0&PME_sys_fl=0&PME_sys_qfn=&PME_sys_sfn[0]=6&PME_sys_sfn[1]=3">YEAR</a></th> <th class="pme-header">CALLS FOR SERVICE</th> <th class="pme-header">MISCELLANEOUS REPORTS</th> <th class="pme-header">COLLISION REPORTS</th> <th class="pme-header">INCIDENT REPORTS</th> <th class="pme-header">FIELD INTERVIEW REPORTS</th> <th class="pme-header">ONLINE TRAFFIC COMPLAINTS</th> <th class="pme-header">TOTAL ALL REPORTS</th> <th class="pme-header">WALK THROUGHS</th> <th class="pme-header">BUSINESS DRIVEBYS</th> <th class="pme-header">RESIDENTIAL DRIVEBYS</th> <th class="pme-header">BUSINESS CHECKS</th> <th class="pme-header">HOUSE CHECKS</th> <th class="pme-header">TARGETED BUSINESS CHECKS</th> <th class="pme-header">TOTAL SECURITY CHECKS</th> <th class="pme-header">SI ARRESTS</th> <th class="pme-header">SERVICE ARRESTS</th> <th class="pme-header">WARRANTS</th> <th class="pme-header">CITATIONS</th> <th class="pme-header">WARNINGS</th> <th class="pme-header">DUI CHARGES</th> <th class="pme-header">VGCSA CHARGES</th> <th class="pme-header">ORDINANCE CHARGES</th> <th class="pme-header">MIP CHARGES</th> <th class="pme-header">PARKING CHARGES</th> <th class="pme-header">PATH VIOLATIONS</th> <th class="pme-header">GOLFCART VIOLATIONS</th> <th class="pme-header">COURT APPEARANCES</th> <th class="pme-header">COLLISION INVESTIGATIONS</th> <th class="pme-header">TRAFFIC ENFORCEMENT</th> <th class="pme-header">TIME ON REPORTS</th> <th class="pme-header">TIME ON ADMIN</th> <th class="pme-header">TIME DIRECTED PATROL</th> <th class="pme-header">TIME FOLLOWUP INVESTIGATIONS</th> <th class="pme-header">TIME IN TRAINING</th> <th class="pme-header">COMMUNITY RELATIONS</th> <th class="pme-header">TIME IN COURT</th> <th class="pme-header">PATH PATROL</th> <th class="pme-header">TIME ON ATV PATROL</th> <th class="pme-header">TIME ON BIKE PATROL</th> <th class="pme-header">TIME ON DB OR SECURITY CHECKS</th> <th class="pme-header">TIME WALK TALK</th> <th class="pme-header">MILES DRIVEN</th> <th class="pme-header">DAYS WORKED</th> <th class="pme-header">Chart ID</th> </tr> <tr class="pme-sortinfo"> <td class="pme-sortinfo" colspan="0"><a class="pme-sortinfo" href="dar-test.php?PME_sys_fl=0&PME_sys_fm=0&PME_sys_qfn=">Clear</a></td> <td class="pme-sortinfo" colspan="50">Sorted By: TEAM ascending</td></tr> <tr class="pme-row-0"> <td class="pme-cell-0">DAllen 1</td> <td class="pme-cell-0">226 1</td> <td class="pme-cell-0">CHARLIE 1</td> <td class="pme-cell-0">1/1/2010</td> <td class="pme-cell-0">JAN</td> <td class="pme-cell-0">2010</td> <td class="pme-cell-0">5</td> <td class="pme-cell-0">1</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">1</td> <td class="pme-cell-0">10</td> <td class="pme-cell-0">80</td> <td class="pme-cell-0">4</td> <td class="pme-cell-0">10</td> <td class="pme-cell-0">1</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">105</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">10</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">60</td> <td class="pme-cell-0">60</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">195</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">95</td> <td class="pme-cell-0"> </td> <td class="pme-cell-0"> 1</td> </tr> <tr class="pme-row-1"> <td class="pme-cell-1">DAllen 1</td> <td class="pme-cell-1">226 1</td> <td class="pme-cell-1">CHARLIE 1</td> <td class="pme-cell-1">1/6/2010</td> <td class="pme-cell-1">JAN</td> <td class="pme-cell-1">2010</td> <td class="pme-cell-1">3</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">2</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">2</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">10</td> <td class="pme-cell-1">1</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">11</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">2</td> <td class="pme-cell-1">2</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">2</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">10</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">15</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">480</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">70</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">89</td> <td class="pme-cell-1"> </td> <td class="pme-cell-1"> 1</td> </tr> <tr class="pme-row-0"> <td class="pme-cell-0">DAllen 1</td> <td class="pme-cell-0">226 1</td> <td class="pme-cell-0">CHARLIE 1</td> <td class="pme-cell-0">1/11/2010</td> <td class="pme-cell-0">JAN</td> <td class="pme-cell-0">2010</td> <td class="pme-cell-0">2</td> <td class="pme-cell-0">1</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">1</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">2</td> <td class="pme-cell-0">12</td> <td class="pme-cell-0">90</td> <td class="pme-cell-0">1</td> <td class="pme-cell-0">12</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">12</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">9</td> <td class="pme-cell-0">7</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">155</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">75</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">415</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">124</td> <td class="pme-cell-0"> </td> <td class="pme-cell-0"> 1</td> </tr> <tr class="pme-row-1"> <td class="pme-cell-1">DAllen 1</td> <td class="pme-cell-1">226 1</td> <td class="pme-cell-1">CHARLIE 1</td> <td class="pme-cell-1">1/15/2010</td> <td class="pme-cell-1">JAN</td> <td class="pme-cell-1">2010</td> <td class="pme-cell-1">4</td> <td class="pme-cell-1">3</td> <td class="pme-cell-1">1</td> <td class="pme-cell-1">1</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">4</td> <td class="pme-cell-1">20</td> <td class="pme-cell-1">30</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">20</td> <td class="pme-cell-1">1</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">71</td> <td class="pme-cell-1">1</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">2</td> <td class="pme-cell-1">1</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">30</td> <td class="pme-cell-1">65</td> <td class="pme-cell-1">70</td> <td class="pme-cell-1">50</td> <td class="pme-cell-1">255</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">25</td> <td class="pme-cell-1">60</td> <td class="pme-cell-1">96</td> <td class="pme-cell-1"> </td> <td class="pme-cell-1"> 1</td> </tr> <tr class="pme-row-0"> <td class="pme-cell-0">DAllen 1</td> <td class="pme-cell-0">226 1</td> <td class="pme-cell-0">CHARLIE 1</td> <td class="pme-cell-0">1/17/2010</td> <td class="pme-cell-0">JAN</td> <td class="pme-cell-0">2010</td> <td class="pme-cell-0">5</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">2</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">2</td> <td class="pme-cell-0">5</td> <td class="pme-cell-0">40</td> <td class="pme-cell-0">1</td> <td class="pme-cell-0">5</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">46</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">1</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">5</td> <td class="pme-cell-0">2</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">350</td> <td class="pme-cell-0">100</td> <td class="pme-cell-0">40</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">50</td> <td class="pme-cell-0">70</td> <td class="pme-cell-0">93</td> <td class="pme-cell-0"> </td> <td class="pme-cell-0"> 1</td> </tr> <tr class="pme-row-1"> <td class="pme-cell-1">DAllen 1</td> <td class="pme-cell-1">226 1</td> <td class="pme-cell-1">CHARLIE 1</td> <td class="pme-cell-1">1/21/2010</td> <td class="pme-cell-1">JAN</td> <td class="pme-cell-1">2010</td> <td class="pme-cell-1">2</td> <td class="pme-cell-1">1</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">1</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">2</td> <td class="pme-cell-1">7</td> <td class="pme-cell-1">20</td> <td class="pme-cell-1">2</td> <td class="pme-cell-1">7</td> <td class="pme-cell-1">1</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">37</td> <td class="pme-cell-1">1</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">13</td> <td class="pme-cell-1">3</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">190</td> <td class="pme-cell-1">40</td> <td class="pme-cell-1">75</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">260</td> <td class="pme-cell-1">105</td> <td class="pme-cell-1">84</td> <td class="pme-cell-1"> </td> <td class="pme-cell-1"> 1</td> </tr> <tr class="pme-row-0"> <td class="pme-cell-0">DAllen 1</td> <td class="pme-cell-0">226 1</td> <td class="pme-cell-0">CHARLIE 1</td> <td class="pme-cell-0">1/26/2010</td> <td class="pme-cell-0">JAN</td> <td class="pme-cell-0">2010</td> <td class="pme-cell-0">3</td> <td class="pme-cell-0">1</td> <td class="pme-cell-0">1</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">2</td> <td class="pme-cell-0">21</td> <td class="pme-cell-0">2</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">21</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">45</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">8</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">40</td> <td class="pme-cell-0">60</td> <td class="pme-cell-0">105</td> <td class="pme-cell-0">15</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">0</td> <td class="pme-cell-0">230</td> <td class="pme-cell-0">90</td> <td class="pme-cell-0">102</td> <td class="pme-cell-0"> </td> <td class="pme-cell-0"> 1</td> </tr> <tr class="pme-row-1"> <td class="pme-cell-1">DAllen 1</td> <td class="pme-cell-1">226 1</td> <td class="pme-cell-1">CHARLIE 1</td> <td class="pme-cell-1">1/30/2010</td> <td class="pme-cell-1">JAN</td> <td class="pme-cell-1">2010</td> <td class="pme-cell-1">2</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">1</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">1</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">10</td> <td class="pme-cell-1">1</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">11</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">2</td> <td class="pme-cell-1">4</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">40</td> <td class="pme-cell-1">40</td> <td class="pme-cell-1">55</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">115</td> <td class="pme-cell-1">0</td> <td class="pme-cell-1">55</td> <td class="pme-cell-1"> </td> <td class="pme-cell-1"> 1</td> </tr> </table> <hr size="1" class="pme-hr" /> <table summary="navigation" class="pme-navigation"> <tr class="pme-navigation"> <td class="pme-buttons"> <input disabled type="submit" class="pme-first" name="PME_sys_disablednavop" value="<<" /> <input disabled type="submit" class="pme-prev" name="PME_sys_disablednavop" value="<" /> <input type="submit" class="pme-add" name="PME_sys_operation" value="Add" /> <input disabled type="submit" class="pme-view" name="PME_sys_disabledoperation" value="View" /> <input disabled type="submit" class="pme-change" name="PME_sys_disabledoperation" value="Change" /> <input disabled type="submit" class="pme-copy" name="PME_sys_disabledoperation" value="Copy" /> <input disabled type="submit" class="pme-delete" name="PME_sys_disabledoperation" value="Delete" /> <input disabled type="submit" class="pme-next" name="PME_sys_disablednavop" value=">" /> <input disabled type="submit" class="pme-last" name="PME_sys_disablednavop" value=">>" /> <input disabled type="submit" class="pme-goto" name="PME_sys_disablednavop" value="Go to" /> <select class="pme-goto" name="PME_sys_disablednavfmdown" disabled onchange="return this.form.submit();"> <option value="0" selected="selected">1</option> </select> </td> <td class="pme-stats"> Page: 1 of 1 Records: 8</td></tr></table> </form> <BR> <a href="logout.php">LOGOUT</a> </body> </html>
  6. Here is the class edit php - hope this helps (very long). Have to send it snippets - exceeds allowed length. Snippet 1: <?php class phpMyEdit_timer /* {{{ */ { var $startTime; var $started; function phpMyEdit_timer($start = true) { $this->started = false; if ($start) { $this->start(); } } function start() { $startMtime = explode(' ', microtime()); $this->startTime = (double) $startMtime[0] + (double) $startMtime[1]; $this->started = true; } function end($iterations = 1) { // get the time, check whether the timer was started later $endMtime = explode(' ', microtime()); if ($this->started) { $endTime = (double)($endMtime[0])+(double)($endMtime[1]); $dur = $endTime - $this->startTime; $avg = 1000 * $dur / $iterations; $avg = round(1000 * $avg) / 1000; return $avg; } else { return 'phpMyEdit_timer ERROR: timer not started'; } } } /* }}} */ if (! function_exists('array_search')) { /* {{{ */ function array_search($needle, $haystack) { foreach ($haystack as $key => $value) { if ($needle == $value) return $key; } return false; } } /* }}} */ if (! function_exists('realpath')) { /* {{{ */ function realpath($path) { return $path; } } /* }}} */ class phpMyEdit { // Class variables {{{ // Database handling var $hn; // hostname var $un; // user name var $pw; // password var $tb; // table var $db; // database var $dbp; // database with point and delimiters var $dbh; // database handle var $close_dbh; // if database handle should be closed // Record manipulation var $key; // name of field which is the unique key var $key_num; // number of field which is the unique key var $key_type; // type of key field (int/real/string/date etc.) var $key_delim; // character used for key value quoting var $rec; // number of record selected for editing var $inc; // number of records to display var $fm; // first record to display var $fl; // is the filter row displayed (boolean) var $fds; // sql field names var $fdn; // sql field names => $k var $num_fds; // number of fields var $options; // options for users: ACDFVPI var $fdd; // field definitions var $qfn; // value of all filters used during the last pass var $sfn; // sort field number (- = descending sort order) var $cur_tab; // current selected tab // Operation var $navop; // navigation buttons/operations var $sw; // filter display/hide/clear button var $operation; // operation to do: Add, Change, Delete var $saveadd; var $moreadd; var $canceladd; var $savechange; var $morechange; var $cancelchange; var $savecopy; var $cancelcopy; var $savedelete; var $canceldelete; var $cancelview; // Additional features var $labels; // multilingual labels var $cgi; // CGI variable features array var $js; // JS configuration array var $dhtml; // DHTML configuration array var $url; // URL array var $message; // informational message to print var $notify; // change notification e-mail adresses var $logtable; // name of optional logtable var $navigation; // navigation style var $tabs; // TAB names var $timer = null; // phpMyEdit_timer object var $sd; var $ed; // sql start and end delimiters '`' in case of MySQL // Predefined variables var $comp_ops = array('<'=>'<','<='=>'<=','='=>'=','>='=>'>=','>'=>'>'); var $sql_aggrs = array( 'sum' => 'Total', 'avg' => 'Average', 'min' => 'Minimum', 'max' => 'Maximum', 'count' => 'Count'); var $page_types = array( 'L' => 'list', 'F' => 'filter', 'A' => 'add', 'V' => 'view', 'C' => 'change', 'P' => 'copy', 'D' => 'delete' ); var $default_buttons = array( 'L' => array('<<','<','add','view','change','copy','delete','>','>>','goto','goto_combo'), 'F' => array('<<','<','add','view','change','copy','delete','>','>>','goto','goto_combo'), 'A' => array('save','more','cancel'), 'C' => array('save','more','cancel'), 'P' => array('save', 'cancel'), 'D' => array('save','cancel'), 'V' => array('change','cancel') ); // }}} /* * column specific functions */ function col_has_sql($k) { return isset($this->fdd[$k]['sql']); } function col_has_sqlw($k) { return isset($this->fdd[$k]['sqlw']) && !$this->virtual($k); } function col_has_values($k) { return isset($this->fdd[$k]['values']) || isset($this->fdd[$k]['values2']); } function col_has_php($k) { return isset($this->fdd[$k]['php']); } function col_has_URL($k) { return isset($this->fdd[$k]['URL']) || isset($this->fdd[$k]['URLprefix']) || isset($this->fdd[$k]['URLpostfix']); } function col_has_multiple($k) { return $this->col_has_multiple_select($k) || $this->col_has_checkboxes($k); } function col_has_multiple_select($k) { return $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table']; } function col_has_checkboxes($k) { return $this->fdd[$k]['select'] == 'C' && ! $this->fdd[$k]['values']['table']; } function col_has_radio_buttons($k) { return $this->fdd[$k]['select'] == 'O' && ! $this->fdd[$k]['values']['table']; } function col_has_datemask($k) { return isset($this->fdd[$k]['datemask']) || isset($this->fdd[$k]['strftimemask']); } /* * functions for indicating whether navigation style is enabled */ function nav_buttons() { return stristr($this->navigation, 'B'); } function nav_text_links() { return stristr($this->navigation, 'T'); } function nav_graphic_links() { return stristr($this->navigation, 'G'); } function nav_up() { return (stristr($this->navigation, 'U') && !($this->buttons[$this->page_type]['up'] === false)); } function nav_down() { return (stristr($this->navigation, 'D') && !($this->buttons[$this->page_type]['down'] === false)); } /* * functions for indicating whether operations are enabled */ function add_enabled() { return stristr($this->options, 'A'); } function change_enabled() { return stristr($this->options, 'C'); } function delete_enabled() { return stristr($this->options, 'D'); } function filter_enabled() { return stristr($this->options, 'F'); } function view_enabled() { return stristr($this->options, 'V'); } function copy_enabled() { return stristr($this->options, 'P') && $this->add_enabled(); } function tabs_enabled() { return $this->display['tabs'] && count($this->tabs) > 0; } function hidden($k) { return stristr($this->fdd[$k]['input'],'H'); } function password($k) { return stristr($this->fdd[$k]['input'],'W'); } function readonly($k) { return stristr($this->fdd[$k]['input'],'R') || $this->virtual($k); } function virtual($k) { return stristr($this->fdd[$k]['input'],'V') && $this->col_has_sql($k); } function add_operation() { return $this->operation == $this->labels['Add'] && $this->add_enabled(); } function change_operation() { return $this->operation == $this->labels['Change'] && $this->change_enabled(); } function copy_operation() { return $this->operation == $this->labels['Copy'] && $this->copy_enabled(); } function delete_operation() { return $this->operation == $this->labels['Delete'] && $this->delete_enabled(); } function view_operation() { return $this->operation == $this->labels['View'] && $this->view_enabled(); } function filter_operation() { return $this->fl && $this->filter_enabled() && $this->list_operation(); } function list_operation() { /* covers also filtering page */ return ! $this->change_operation() && ! $this->add_operation() && ! $this->copy_operation() && ! $this->delete_operation() && ! $this->view_operation(); } function next_operation() { return ($this->navop == $this->labels['Next']) || ($this->navop == '>'); } function prev_operation() { return ($this->navop == $this->labels['Prev']) || ($this->navop == '<'); } function first_operation() { return ($this->navop == $this->labels['First']) || ($this->navop == '<<'); } function last_operation() { return ($this->navop == $this->labels['Last']) || ($this->navop == '>>'); } function clear_operation() { return $this->sw == $this->labels['Clear']; } function add_canceled() { return $this->canceladd == $this->labels['Cancel']; } function view_canceled() { return $this->cancelview == $this->labels['Cancel']; } function change_canceled() { return $this->cancelchange == $this->labels['Cancel']; } function copy_canceled() { return $this->cancelcopy == $this->labels['Cancel']; } function delete_canceled() { return $this->canceldelete == $this->labels['Cancel']; } function is_values2($k, $val = 'X') /* {{{ */ { return $val === null || (isset($this->fdd[$k]['values2']) && !isset($this->fdd[$k]['values']['table'])); } /* }}} */ function processed($k) /* {{{ */ { if ($this->virtual($k)) { return false; } $options = @$this->fdd[$k]['options']; if (! isset($options)) { return true; } return ($this->saveadd == $this->labels['Save'] && stristr($options, 'A')) || ($this->moreadd == $this->labels['More'] && stristr($options, 'A')) || ($this->savechange == $this->labels['Save'] && stristr($options, 'C')) || ($this->morechange == $this->labels['Apply'] && stristr($options, 'C')) || ($this->savecopy == $this->labels['Save'] && stristr($options, 'P')) || ($this->savedelete == $this->labels['Save'] && stristr($options, 'D')); } /* }}} */ function displayed($k) /* {{{ */ { if (is_numeric($k)) { $k = $this->fds[$k]; } $options = @$this->fdd[$k]['options']; if (! isset($options)) { return true; } return ($this->add_operation() && stristr($options, 'A')) || ($this->view_operation() && stristr($options, 'V')) || ($this->change_operation() && stristr($options, 'C')) || ($this->copy_operation() && stristr($options, 'P')) || ($this->delete_operation() && stristr($options, 'D')) || ($this->filter_operation() && stristr($options, 'F')) || ($this->list_operation() && stristr($options, 'L')); } /* }}} */ function debug_var($name, $val) /* {{{ */ { if (is_array($val) || is_object($val)) { echo "<pre>$name\n"; ob_start(); //print_r($val); var_dump($val); $content = ob_get_contents(); ob_end_clean(); echo htmlspecialchars($content); echo "</pre>\n"; } else { echo 'debug_var()::<i>',htmlspecialchars($name),'</i>'; echo '::<b>',htmlspecialchars($val),'</b>::',"<br />\n"; } } /* }}} */ /* * sql functions */ function sql_connect() /* {{{ */ { $this->dbh = @ini_get('allow_persistent') ? @mysql_pconnect($this->hn, $this->un, $this->pw) : @mysql_connect($this->hn, $this->un, $this->pw); } /* }}} */ function sql_disconnect() /* {{{ */ { if ($this->close_dbh) { @mysql_close($this->dbh); $this->dbh = null; } } /* }}} */ function sql_fetch(&$res, $type = 'a') /* {{{ */ { if($type == 'n') $type = MYSQL_NUM; else $type = MYSQL_ASSOC; return @mysql_fetch_array($res, $type); } /* }}} */ function sql_free_result(&$res) /* {{{ */ { return @mysql_free_result($res); } /* }}} */ function sql_affected_rows(&$dbh) /* {{{ */ { return @mysql_affected_rows($dbh); } /* }}} */ function sql_field_len(&$res,$field) /* {{{ */ { return @mysql_field_len($res, $field); } /* }}} */ function sql_insert_id() /* {{{ */ { return mysql_insert_id($this->dbh); } /* }}} */ function sql_limit($start, $more = null) /* {{{ */ { if ($more < 0) return; if (!is_numeric($start)) return; $ret = ' LIMIT '.$start; if (is_numeric($more)) { $ret .= ','.$more; } $ret .= ' '; return $ret; } /* }}} */ function sql_delimiter() /* {{{ */ { $this->sd = '`'; $this->ed='`'; return $this->sd; } /* }}} */ function myquery($qry, $line = 0, $debug = 0) /* {{{ */ { global $debug_query; if ($debug_query || $debug) { $line = intval($line); echo '<h4>MySQL query at line ',$line,'</h4>',htmlspecialchars($qry),'<hr size="1" />',"\n"; } if (isset($this->db)) { $ret = @mysql_db_query($this->db, $qry, $this->dbh); } else { $ret = @mysql_query($qry, $this->dbh); } if (! $ret) { echo '<h4>MySQL error ',mysql_errno($this->dbh),'</h4>'; echo htmlspecialchars(mysql_error($this->dbh)),'<hr size="1" />',"\n"; } return $ret; } /* }}} */ /* end of sql functions */ function make_language_labels($language) /* {{{ */ { // just try the first language and variant // this isn't content-negotiation rfc compliant $language = strtoupper($language); // try the full language w/ variant $file = $this->dir['lang'].'PME.lang.'.$language.'.inc'; while (! file_exists($file)) { $pos = strrpos($language, '-'); if ($pos === false) { $file = $this->dir['lang'].'PME.lang.EN.inc'; break; } $language = substr($language, 0, $pos); $file = $this->dir['lang'].'PME.lang.'.$language.'.inc'; } $ret = @include($file); if (! is_array($ret)) { return $ret; } $small = array( 'Search' => 'v', 'Hide' => '^', 'Clear' => 'X', 'Query' => htmlspecialchars('>')); if ((!$this->nav_text_links() && !$this->nav_graphic_links()) || !isset($ret['Search']) || !isset($ret['Query']) || !isset($ret['Hide']) || !isset($ret['Clear'])) { foreach ($small as $key => $val) { $ret[$key] = $val; } } return $ret; } /* }}} */ function set_values($field_num, $prepend = null, $append = null, $strict = false) /* {{{ */ { return (array) $prepend + (array) $this->fdd[$field_num]['values2'] + (isset($this->fdd[$field_num]['values']['table']) || $strict ? $this->set_values_from_table($field_num, $strict) : array()) + (array) $append; } /* }}} */ function set_values_from_table($field_num, $strict = false) /* {{{ */ { $db = &$this->fdd[$field_num]['values']['db']; $table = $this->sd.$this->fdd[$field_num]['values']['table'].$this->ed; $key = &$this->fdd[$field_num]['values']['column']; $desc = &$this->fdd[$field_num]['values']['description']; $dbp = isset($db) ? $this->sd.$db.$this->ed.'.' : $this->dbp; $qparts['type'] = 'select'; if ($table != $this->sd.$this->ed) { $qparts['select'] = 'DISTINCT '.$table.'.'.$this->sd.$key.$this->ed; if ($desc && is_array($desc) && is_array($desc['columns'])) { $qparts['select'] .= ',CONCAT('; // ) $num_cols = sizeof($desc['columns']); if (isset($desc['divs'][-1])) { $qparts['select'] .= '"'.addslashes($desc['divs'][-1]).'",'; } foreach ($desc['columns'] as $key => $val) { if ($val) { $qparts['select'] .= 'IFNULL(CAST('.$this->sd.$val.$this->ed.' AS CHAR),"")'; if ($desc['divs'][$key]) { $qparts['select'] .= ',"'.addslashes($desc['divs'][$key]).'"'; } $qparts['select'] .= ','; } } $qparts['select']{strlen($qparts['select']) - 1} = ')'; $qparts['select'] .= ' AS '.$this->sd.'PMEalias'.$field_num.$this->ed; $qparts['orderby'] = $this->sd.'PMEalias'.$field_num.$this->ed; } else if ($desc && is_array($desc)) { // TODO } else if ($desc) { $qparts['select'] .= ','.$table.'.'.$this->sd.$desc.$this->ed; $qparts['orderby'] = $this->sd.$desc.$this->ed; } else if ($key) { $qparts['orderby'] = $this->sd.$key.$this->ed; } $qparts['from'] = $dbp.$table; $ar = array( 'table' => $table, 'column' => $column, 'description' => $desc); $qparts['where'] = $this->substituteVars($this->fdd[$field_num]['values']['filters'], $ar); if ($this->fdd[$field_num]['values']['orderby']) { $qparts['orderby'] = $this->substituteVars($this->fdd[$field_num]['values']['orderby'], $ar); } } else { /* simple value extraction */ $key = &$this->fds[$field_num]; $this->virtual($field_num) && $key = $this->fqn($field_num); $qparts['select'] = 'DISTINCT '.$this->sd.$key.$this->ed.' AS PMEkey'; $qparts['orderby'] = 'PMEkey'; $qparts['from'] = $this->dbp.$this->sd.$this->tb.$this->ed; } $values = array(); $res = $this->myquery($this->get_SQL_query($qparts), __LINE__); while ($row = $this->sql_fetch($res, 'n')) { $values[$row[0]] = $desc ? $row[1] : $row[0]; } return $values; } /* }}} */ function fqn($field, $dont_desc = false, $dont_cols = false) /* {{{ */ { is_numeric($field) || $field = array_search($field, $this->fds); // if read SQL expression exists use it if ($this->col_has_sql($field) && !$this->col_has_values($field)) return $this->fdd[$field]['sql']; // on copy/change always use simple key retrieving if ($this->add_operation() || $this->copy_operation() || $this->change_operation()) { $ret = $this->sd.'PMEtable0'.$this->ed.'.'.$this->sd.$this->fds[$field].$this->ed; } else { if ($this->fdd[$this->fds[$field]]['values']['description'] && ! $dont_desc) { $desc = &$this->fdd[$this->fds[$field]]['values']['description']; if (is_array($desc) && is_array($desc['columns'])) { $ret = 'CONCAT('; // ) $num_cols = sizeof($desc['columns']); if (isset($desc['divs'][-1])) { $ret .= '"'.addslashes($desc['divs'][-1]).'",'; } foreach ($desc['columns'] as $key => $val) { if ($val) { $ret .= 'IFNULL(CAST('.$this->sd.'PMEjoin'.$field.$this->ed.'.'.$this->sd.$val.$this->ed.' AS CHAR),"")'; if ($desc['divs'][$key]) { $ret .= ',"'.addslashes($desc['divs'][$key]).'"'; } $ret .= ','; } } $ret{strlen($ret) - 1} = ')'; } else if (is_array($desc)) { // TODO } else { $ret = $this->sd.'PMEjoin'.$field.$this->ed.'.'.$this->sd.$this->fdd[$this->fds[$field]]['values']['description'].$this->ed; } // TODO: remove me } elseif (0 && $this->fdd[$this->fds[$field]]['values']['column'] && ! $dont_cols) { $ret = $this->sd.'PMEjoin'.$field.$this->ed.'.'.$this->fdd[$this->fds[$field]]['values']['column']; } else { $ret = $this->sd.'PMEtable0'.$this->ed.'.'.$this->sd.$this->fds[$field].$this->ed; } // TODO: not neccessary, remove me! if (is_array($this->fdd[$this->fds[$field]]['values2'])) { } } return $ret; } /* }}} */ function get_SQL_main_list_query_parts() /* {{{ */ { /* * Prepare the SQL Query from the data definition file */ $qparts['type'] = 'select'; $qparts['select'] = $this->get_SQL_column_list(); // Even if the key field isn't displayed, we still need its value if ($select_recs) { if (!in_array ($this->key, $this->fds)) { $qparts['select'] .= ','.$this->fqn($this->key); } } $qparts['from'] = $this->get_SQL_join_clause(); $qparts['where'] = $this->get_SQL_where_from_query_opts(); // build up the ORDER BY clause if (isset($this->sfn)) { $sort_fields = array(); $sort_fields_w = array(); foreach ($this->sfn as $field) { if ($field[0] == '-') { $field = substr($field, 1); $desc = true; } else { $field = $field; $desc = false; } $sort_field = $this->fqn($field); $sort_field_w = $this->fdd[$field]['name']; $this->col_has_sql($field) && $sort_field_w .= ' (sql)'; if ($desc) { $sort_field .= ' DESC'; $sort_field_w .= ' '.$this->labels['descending']; } else { $sort_field_w .= ' '.$this->labels['ascending']; } $sort_fields[] = $sort_field; $sort_fields_w[] = $sort_field_w; } if (count($sort_fields) > 0) { $qparts['orderby'] = join(',', $sort_fields); } } $qparts['limit'] = $listall ? '' : $this->sql_limit($this->fm,$this->inc); $this->sort_fields_w = $sort_fields_w; // due to display sorting sequence return $qparts; } /* }}} */ function get_SQL_main_list_query($qparts) /* {{{ */ { return $this->get_SQL_query($qparts); } /* }}} */ function get_SQL_query($parts) /* {{{ */ { foreach ($parts as $k => $v) { $parts[$k] = trim($parts[$k]); } switch ($parts['type']) { case 'select': $ret = 'SELECT '; if ($parts['DISTINCT']) $ret .= 'DISTINCT '; $ret .= $parts['select']; $ret .= ' FROM '.$parts['from']; if ($parts['where'] != '') $ret .= ' WHERE '.$parts['where']; if ($parts['groupby'] != '') $ret .= ' GROUP BY '.$parts['groupby']; if ($parts['having'] != '') $ret .= ' HAVING '.$parts['having']; if ($parts['orderby'] != '') $ret .= ' ORDER BY '.$parts['orderby']; if ($parts['limit'] != '') $ret .= ' '.$parts['limit']; if ($parts['procedure'] != '') $ret .= ' PROCEDURE '.$parts['procedure']; break; case 'update': $ret = 'UPDATE '.$parts['table']; $ret .= ' SET '.$parts['fields']; if ($parts['where'] != '') $ret .= ' WHERE '.$parts['where']; break; case 'insert': $ret = 'INSERT INTO '.$parts['table']; $ret .= ' VALUES '.$parts['values']; break; case 'delete': $ret = 'DELETE FROM '.$parts['table']; if ($parts['where'] != '') $ret .= ' WHERE '.$parts['where']; break; default: die('unknown query type'); break; } return $ret; } /* }}} */ function get_SQL_column_list() /* {{{ */ { $fields = array(); for ($k = 0; $k < $this->num_fds; $k++) { if (! $this->displayed[$k] && $k != $this->key_num) { continue; } $fields[] = $this->fqn($k).' AS '.$this->sd.'qf'.$k.$this->ed; // no delimiters here, or maybe some yes if ($this->col_has_values($k)) { if($this->col_has_sql($k)) $fields[] = $this->fdd[$k]['sql'].' AS '.$this->sd.'qf'.$k.'_idx'.$this->ed; else $fields[] = $this->fqn($k, true, true).' AS '.$this->sd.'qf'.$k.'_idx'.$this->ed; } if ($this->col_has_datemask($k)) { $fields[] = 'UNIX_TIMESTAMP('.$this->fqn($k).') AS '.$this->sd.'qf'.$k.'_timestamp'.$this->ed; } } return join(',', $fields); } /* }}} */ function get_SQL_join_clause() /* {{{ */ { $main_table = $this->sd.'PMEtable0'.$this->ed; $join_clause = $this->sd.$this->tb.$this->ed." AS $main_table"; for ($k = 0, $numfds = sizeof($this->fds); $k < $numfds; $k++) { $main_column = $this->fds[$k]; if($this->fdd[$main_column]['values']['db']) { $dbp = $this->sd.$this->fdd[$main_column]['values']['db'].$this->ed.'.'; } else { //$dbp = $this->dbp; } $table = $this->sd.$this->fdd[$main_column]['values']['table'].$this->ed; $join_column = $this->sd.$this->fdd[$main_column]['values']['column'].$this->ed; $join_desc = $this->sd.$this->fdd[$main_column]['values']['description'].$this->ed; if ($join_desc != $this->sd.$this->ed && $join_column != $this->sd.$this->ed) { $join_table = $this->sd.'PMEjoin'.$k.$this->ed; $ar = array( 'main_table' => $main_table, 'main_column' => $this->sd.$main_column.$this->ed, 'join_table' => $join_table, 'join_column' => $join_column, 'join_description' => $join_desc); $join_clause .= " LEFT OUTER JOIN $dbp".$table." AS $join_table ON ("; $join_clause .= isset($this->fdd[$main_column]['values']['join']) ? $this->substituteVars($this->fdd[$main_column]['values']['join'], $ar) : "$join_table.$join_column = $main_table.".$this->sd.$main_column.$this->ed; $join_clause .= ')'; } } return $join_clause; } /* }}} */ function get_SQL_where_from_query_opts($qp = null, $text = 0) /* {{{ */ { if ($qp == null) { $qp = $this->query_opts; } $where = array(); foreach ($qp as $field => $ov) { if (is_numeric($field)) { $tmp_where = array(); foreach ($ov as $field2 => $ov2) { $tmp_where[] = sprintf('%s %s %s', $field2, $ov2['oper'], $ov2['value']); } $where[] = '('.join(' OR ', $tmp_where).')'; } else { if (is_array($ov['value'])) { $tmp_ov_val = ''; foreach ($ov['value'] as $ov_val) { strlen($tmp_ov_val) > 0 && $tmp_ov_val .= ' OR '; $tmp_ov_val .= sprintf('FIND_IN_SET("%s",%s)', $ov_val, $field); } $where[] = "($tmp_ov_val)"; } else { $where[] = sprintf('%s %s %s', $field, $ov['oper'], $ov['value']); } } } // Add any coder specified filters if (! $text && $this->filters) { $where[] = '('.$this->filters.')'; } if (count($where) > 0) { if ($text) { return str_replace('%', '*', join(' AND ',$where)); } else { return join(' AND ',$where); } } return ''; /* empty string */ } /* }}} */ function gather_query_opts() /* {{{ */ { $this->query_opts = array(); $this->prev_qfn = $this->qfn; $this->qfn = ''; if ($this->clear_operation()) { return; } // gathers query options into an array, $this->query_opts $qo = array(); for ($k = 0; $k < $this->num_fds; $k++) { $l = 'qf'.$k; $lc = 'qf'.$k.'_comp'; $li = 'qf'.$k.'_id'; $m = $this->get_sys_cgi_var($l); $mc = $this->get_sys_cgi_var($lc); $mi = $this->get_sys_cgi_var($li); if (! isset($m) && ! isset($mi)) { continue; } if (is_array($m) || is_array($mi)) { if (is_array($mi)) { $m = $mi; $l = $li; } if (in_array('*', $m)) { continue; } if ($this->col_has_values($k) && $this->col_has_multiple($k)) { foreach (array_keys($m) as $key) { $m[$key] = addslashes($m[$key]); } $qo[$this->fqn($k)] = array('value' => $m); } else { $qf_op = ''; foreach (array_keys($m) as $key) { if ($qf_op == '') { $qf_op = 'IN'; $qf_val = '"'.addslashes($m[$key]).'"'; $afilter = ' IN ("'.addslashes($m[$key]).'"'; // ) } else { $afilter = $afilter.',"'.addslashes($m[$key]).'"'; $qf_val .= ',"'.addslashes($m[$key]).'"'; } $this->qfn .= '&'.$this->cgi['prefix']['sys'].$l.'['.rawurlencode($key).']='.rawurlencode($m[$key]); } $afilter = $afilter.')'; // XXX: $dont_desc and $dont_cols hack $dont_desc = isset($this->fdd[$k]['values']['description']); $dont_cols = isset($this->fdd[$k]['values']['column']); $qo[$this->fqn($k, $dont_desc, $dont_cols)] = array('oper' => $qf_op, 'value' => "($qf_val)"); // ) } } else if (isset($mi)) { if ($mi == '*') { continue; } if ($this->fdd[$k]['select'] != 'M' && $this->fdd[$k]['select'] != 'D' && $mi == '') { continue; } $afilter = addslashes($mi); $qo[$this->fqn($k, true, true)] = array('oper' => '=', 'value' => "'$afilter'"); $this->qfn .= '&'.$this->cgi['prefix']['sys'].$li.'='.rawurlencode($mi); } else if (isset($m)) { if ($m == '*') { continue; } if ($this->fdd[$k]['select'] != 'M' && $this->fdd[$k]['select'] != 'D' && $m == '') { continue; } $afilter = addslashes($m); if ($this->fdd[$k]['select'] == 'N') { $mc = in_array($mc, $this->comp_ops) ? $mc : '='; $qo[$this->fqn($k)] = array('oper' => $mc, 'value' => "'$afilter'"); $this->qfn .= '&'.$this->cgi['prefix']['sys'].$l .'='.rawurlencode($m); $this->qfn .= '&'.$this->cgi['prefix']['sys'].$lc.'='.rawurlencode($mc); } else { $afilter = '%'.str_replace('*', '%', $afilter).'%'; $ids = array(); $ar = array(); $ar[$this->fqn($k)] = array('oper' => 'LIKE', 'value' => "'$afilter'"); if (is_array($this->fdd[$k]['values2'])) { foreach ($this->fdd[$k]['values2'] as $key => $val) { if (strlen($m) > 0 && stristr($val, $m)) { $ids[] = '"'.addslashes($key).'"'; } } if (count($ids) > 0) { $ar[$this->fqn($k, true, true)] = array('oper' => 'IN', 'value' => '('.join(',', $ids).')'); } } $qo[] = $ar; $this->qfn .= '&'.$this->cgi['prefix']['sys'].$l.'='.rawurlencode($m); } } } $this->query_opts = $qo; } /* }}} */ /* * Create JavaScripts */ function form_begin() /* {{{ */ { $page_name = htmlspecialchars($this->page_name); if ($this->add_operation() || $this->change_operation() || $this->copy_operation() || $this->view_operation() || $this->delete_operation()) { $field_to_tab = array(); for ($tab = $k = $this->cur_tab = 0; $k < $this->num_fds; $k++) { if (isset($this->fdd[$k]['tab'])) { if ($tab == 0 && $k > 0) { $this->tabs[0] = 'PMEtab0'; $this->cur_tab = 1; $tab++; } if (is_array($this->fdd[$k]['tab'])) { $this->tabs[$tab] = @$this->fdd[$k]['tab']['name']; $this->fdd[$k]['tab']['default'] && $this->cur_tab = $tab; } else { $this->tabs[$tab] = @$this->fdd[$k]['tab']; } $tab++; } $field_to_tab[$k] = max(0, $tab - 1); } if (preg_match('/^'.$this->dhtml['prefix'].'tab(\d+)$/', $this->get_sys_cgi_var('cur_tab'), $parts)) { $this->cur_tab = $parts[1]; } if ($this->tabs_enabled()) { // initial TAB styles echo '<style type="text/css" media="screen">',"\n"; for ($i = 0; $i < count($this->tabs); $i++) { echo ' #'.$this->dhtml['prefix'].'tab',$i,' { display: '; echo (($i == $this->cur_tab || $this->tabs[$i] == 'PMEtab0' ) ? 'block' : 'none') ,'; }',"\n"; } echo '</style>',"\n"; // TAB javascripts echo '<script type="text/javascript"><!--',"\n\n"; $css_class_name1 = $this->getCSSclass('tab', $position); $css_class_name2 = $this->getCSSclass('tab-selected', $position); echo 'var '.$this->js['prefix'].'cur_tab = "'.$this->dhtml['prefix'].'tab',$this->cur_tab,'";
  7. Apologize for that; <?php require_once('auth.php'); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Charts PD</title> <style type="text/css"> hr.pme-hr { border: 0px solid; padding: 0px; margin: 0px; border-top-width: 1px; height: 1px; } table.pme-main { border: #004d9c 1px solid; border-collapse: collapse; border-spacing: 0px; width: 100%; } table.pme-navigation { border: #004d9c 0px solid; border-collapse: collapse; border-spacing: 0px; width: 100%; } td.pme-navigation-0, td.pme-navigation-1 { white-space: nowrap; } th.pme-header { border: #004d9c 1px solid; padding: 4px; background: #add8e6; } td.pme-key-0, td.pme-value-0, td.pme-help-0, td.pme-navigation-0, td.pme-cell-0, td.pme-key-1, td.pme-value-1, td.pme-help-0, td.pme-navigation-1, td.pme-cell-1, td.pme-sortinfo, td.pme-filter { border: #004d9c 1px solid; padding: 3px; } td.pme-buttons { text-align: left; } td.pme-message { text-align: center; } td.pme-stats { text-align: left; } </style> </head> <body> <h3>Data Records</h3> <?php $opts['hn'] = 'localhost'; $opts['un'] = 'test'; $opts['pw'] = 'test'; $opts['db'] = 'charts'; $opts['tb'] = 'data'; $opts['key'] = 'Id'; $opts['key_type'] = 'int'; $opts['sort_field'] = array('TEAM'); $opts['inc'] = 10; $opts['options'] = 'A'; $opts['multiple'] = '4'; $opts['navigation'] = 'DBT'; $opts['display'] = array( 'form' => true, 'query' => true, 'sort' => true, 'time' => false, 'tabs' => true ); $opts['js']['prefix'] = 'PME_js_'; $opts['dhtml']['prefix'] = 'PME_dhtml_'; $opts['cgi']['prefix']['operation'] = 'PME_op_'; $opts['cgi']['prefix']['sys'] = 'PME_sys_'; $opts['cgi']['prefix']['data'] = 'PME_data_'; $opts['language'] = $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '-UTF8'; $opts['filters'] = "Name = '{$_SESSION['SESS_LOGIN']}'"; /* Table-level filter capability. If set, it is included in the WHERE clause of any generated SELECT statement in SQL query. This gives you ability to work only with subset of data from table. $opts['filters'] = "column1 like '%11%' AND column2<17"; $opts['filters'] = "section_id = 9"; $opts['filters'] = "PMEtable0.sessions_count > 200"; */ $opts['fdd']['Id'] = array( 'name' => 'Id', 'select' => 'H', 'options' => 'AVCPDR', // auto increment 'maxlen' => 11, 'default' => '0', 'sort' => false ); $opts['fdd']['NAME']= array( 'name' => 'NAME', 'select' => 'T', 'php' => 'name.php', 'sort' => false ); $opts['fdd']['OFFICERID'] = array( 'name' => 'BADGE', 'select' => 'T', 'php' => 'badge.php', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TEAM'] = array( 'name' => 'TEAM', 'select' => 'T', 'maxlen' => 15, 'php' => 'team.php', 'sort' => false ); $opts['fdd']['DATE'] = array( 'name' => 'DATE OF REPORT', 'select' => 'T', 'maxlen' => 11, 'default' => 'YYYY-MM-DD', 'sort' => false ); $opts['fdd']['MONTH'] = array( 'name' => 'MONTH', 'select' => 'D', 'maxlen' => 15, 'values' => array('JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'), 'sort' => true ); $opts['fdd']['YEAR'] = array( 'name' => 'YEAR', 'select' => 'D', 'maxlen' => 5, 'values' => array('2010','2011','2012','2013','2014','2015'), 'sort' => true ); $opts['fdd']['CALLS_FOR_SERVICE']= array( 'name' => 'CALLS FOR SERVICE', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['MISCELLANEOUS_REPORTS'] = array( 'name' => 'MISCELLANEOUS REPORTS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['COLLISION_REPORTS'] = array( 'name' => 'COLLISION REPORTS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['INCIDENT_REPORTS'] = array( 'name' => 'INCIDENT REPORTS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['FIELD_INTERVIEW_REPORTS'] = array( 'name' => 'FIELD INTERVIEW REPORTS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['ONLINE_TRAFFIC_COMPLAINTS'] = array( 'name' => 'ONLINE TRAFFIC COMPLAINTS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TOTAL_ALL_REPORTS'] = array( 'name' => 'TOTAL ALL REPORTS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['WALK_THROUGHS'] = array( 'name' => 'WALK THROUGHS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['BUSINESS_DRIVEBYS'] = array( 'name' => 'BUSINESS DRIVEBYS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['RESIDENTIAL_DRIVEBYS'] = array( 'name' => 'RESIDENTIAL DRIVEBYS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['BUSINESS_CHECKS'] = array( 'name' => 'BUSINESS CHECKS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['HOUSE_CHECKS'] = array( 'name' => 'HOUSE CHECKS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TARGETED_BUSINESS_CHECKS'] = array( 'name' => 'TARGETED BUSINESS CHECKS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TOTAL_SECURITY'] = array( 'name' => 'TOTAL SECURITY CHECKS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['SI_ARRESTS'] = array( 'name' => 'SI ARRESTS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['SERVICE_ARRESTS'] = array( 'name' => 'SERVICE ARRESTS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['WARRANTS'] = array( 'name' => 'WARRANTS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['CITATIONS'] = array( 'name' => 'CITATIONS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['WARNINGS'] = array( 'name' => 'WARNINGS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['DUI_CHARGES'] = array( 'name' => 'DUI CHARGES', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['VGCSA_CHARGES'] = array( 'name' => 'VGCSA CHARGES', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['ORDINANCE_CHARGES'] = array( 'name' => 'ORDINANCE CHARGES', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['MIP_CHARGES'] = array( 'name' => 'MIP CHARGES', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['PARKING_CHARGES'] = array( 'name' => 'PARKING CHARGES', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['PATH_VIOLATIONS'] = array( 'name' => 'PATH VIOLATIONS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['GOLFCART_VIOLATIONS'] = array( 'name' => 'GOLFCART VIOLATIONS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['COURT_APPEARANCES'] = array( 'name' => 'COURT APPEARANCES', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['COLLISION_INVESTIGATIONS'] = array( 'name' => 'COLLISION INVESTIGATIONS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TRAFFIC_ENFORCEMENT'] = array( 'name' => 'TRAFFIC ENFORCEMENT', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TIME_ON_REPORTS'] = array( 'name' => 'TIME ON REPORTS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TIME_ON_ADMIN'] = array( 'name' => 'TIME ON ADMIN', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TIME_DIRECTED_PATROL'] = array( 'name' => 'TIME DIRECTED PATROL', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TIME_FOLLOWUP_INVESTIGATIONS'] = array( 'name' => 'TIME FOLLOWUP INVESTIGATIONS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TIME_IN_TRAINING'] = array( 'name' => 'TIME IN TRAINING', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['COMMUNITY_RELATIONS'] = array( 'name' => 'COMMUNITY RELATIONS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TIME_IN_COURT'] = array( 'name' => 'TIME IN COURT', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['PATH_PATROL'] = array( 'name' => 'PATH PATROL', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TIME_ATVPATROL'] = array( 'name' => 'TIME ON ATV PATROL', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TIME_BIKEPATROL'] = array( 'name' => 'TIME ON BIKE PATROL', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TIME_DBCHECKS'] = array( 'name' => 'TIME ON DB OR SECURITY CHECKS', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TIME_WALK_TALK'] = array( 'name' => 'TIME WALK TALK', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['MILES_DRIVEN'] = array( 'name' => 'MILES DRIVEN', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['DAYS_WORKED'] = array( 'name' => 'DAYS WORKED', 'select' => 'N', 'maxlen' => 5, 'sort' => false ); $opts['fdd']['TeamID'] = array( 'name' => 'Chart ID', 'select' => 'H', 'maxlen' => 2, 'sort' => false, 'php' => 'id.php' ); require_once '../phpMyEdit.class.php'; new phpMyEdit($opts); ?> <BR> <a href="logout.php">LOGOUT</a> </body> </html>
  8. Thanks for the reply. Here is a copy of the form. If you need me to send anything else please let me know. The form was created with a table editor called Phpmyedit. [attachment deleted by admin]
  9. My data is called to form via Filter; $opts['filters'] = "Name = '{$_SESSION['SESS_LOGIN']}'"; I then echo the session variable to populate name field; Name.php <?php require_once('auth.php'); echo $_SESSION['SESS_LOGIN']; ?> Now I need to Update the form field with that echo session. Currently, although the echo session works, when I ever submit form; everything but the echo'd variables gets posted to database.
×
×
  • 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.