Jump to content

Search the Community

Showing results for tags 'events'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 4 results

  1. Hi, Please help me with the following situation. I have a jquery code like this: $('#go').on('click', function () { $.ajax({ type: 'POST', url: 'returnPDO.php', dataType: "json", data: { id: "1", rows: "7" }, success: function (data) { ...CODE.... } }); }); Now, I have another event (keypress) that I would like to execute the same code from on.click above . $( "#searchTbl" ).keypress(function() { $.ajax({ type: 'POST', url: 'returnPDO.php', dataType: "json", data: { id: "1", rows: "7" }, success: function (data) { ...CODE.... } }); }); It's there a way to include the whole $.ajax code only once ? Otherwise if I change something inside on.click I need to change on keypress code as well. Thank you
  2. I registered a few days ago for help on this thread but didn't post again on it now because it has been marked answered and I thought I'd better not bump it. I received help in a way that has been the most encouraging since I began my calendar project. I'm wondering, though, if you would help me understand why I'm not successful at implementing the advice to the point that events are inserting into my calendar. My testing database has only one table: events and in events, only two columns (other than id): "startdt" and "description". This is a screenshot of how the table's columns are set upL This is a screenshot of the table content: This is my code with the edits added from the support thread: <?PHP $var = mysql_real_escape_string($_GET['startdt, description']); $con=mysql_connect("localhost","user","password"); // Check connection if (mysql_connect_error()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } //select a database to work with $selected = mysql_select_db("mydatabase_",$con) or die("Could not select mydatabase_"); //execute the SQL query and return records $result = mysql_query("SELECT information FROM events WHERE value='$startdt', 'description'"); //fetch tha data from the database while ($row = mysql_fetch_array($result)) { echo $row{'startdt, description'}; } //close the connection mysql_close($con); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="css/master.css" type="text/css" media="all"> <meta http-equiv="Content-Type" content="text/html" /> <title>Yet Another Test</title> </head> <body> <?php $currMonth = isset($_GET['month']) ? $_GET['month'] : date('n'); $currYear = isset($_GET['year']) ? $_GET['year'] : date('Y'); $today = (($currYear == date('Y')) && ($currMonth == date('n'))) ? date('j') : 0; $prevMonth = $currMonth==1 ? 12 : $currMonth-1; $nextMonth = $currMonth==12? 1 : $currMonth+1; $prevYear = $currMonth==1 ? $currYear-1 : $currYear; $nextYear = $currMonth==12? $currYear+1 : $currYear; $day1 = mktime(0,0,0,$currMonth,1,$currYear); $dim = date('t', $day1); $dayN = mktime(0,0,0,$currMonth,$dim,$currYear); $dow1 = (date('w',$day1)+0) % 7; $dowN = (date('w',$dayN)+0) % 7; $calHead = date('F Y',$day1); echo <<<EOT <div class="calwrapper"> <div class="caltitle"><h1>Calendar</h1></div> <div class="container"> <div class="fnl first"></div> <div class="adjust"></div> <div class="fnl last"></div> </div> <div class="caldisplay"> <table cellspacing="0"> <tr> <td class="hd"><a class="cal_button" href="$_SERVER[PHP_SELF]?year=$prevYear&month=$prevMonth"> Prev </a></td> <td colspan="5" class="adjust">$calHead</td> <td class="hd"><a class="cal_button" href="$_SERVER[PHP_SELF]?year=$nextYear&month=$nextMonth"> Next </a></td> </tr> <tr> <th class="we">Sun</th> <th class="wd">Mon</th> <th class="wd">Tue</th> <th class="wd">Wed</th> <th class="wd">Thu</th> <th class="wd">Fri</th> <th class="we">Sat</th> </tr> <tr> EOT; for ($d=0;$d<$dow1;$d++) echo "<td class=\"hd\"> </td>"; $c = $dow1; for ($d=1; $d<=$dim; $d++, $c++) { if ($c%7==0) echo "</tr><tr>"; $cl = ($c%7==5) || ($c%7==6) ? 'we' : 'wd'; $st = ($d == $today) ? "style='padding: 0px;'" : ''; echo "<td class=\"$cl\" $st>\n"; echo "$d" ; echo "</td>\n"; } while ($c++ % 7 != 0) echo '<td class=\"hd\"> </td>'; echo "</tr></table>\n"; echo '</div></div>'; // calander entries. Use the date as the key (in YYYY/MM/DD format) $entries = array( '2014/8/16' => array( 'Event', ), ); for ($d=1; $d<=$dim; $d++, $c++) { if ($c%7==0) echo "</tr><tr>"; $cl = ($c%7==5) || ($c%7==6) ? 'we' : 'wd'; $st = ($d == $today) ? "style='padding: 0px;'" : ''; echo "<td class=\"$cl\" $st>\n"; echo "$d" ; echo "</td>\n"; } // construct the date, this will be used to check to if the key exists in the $entries array $dateKey = "$currYear/$currMonth/$d"; // check if the key exists in the $entries array if(array_key_exists($dateKey, $entries)) { // for each event, list it in a seperate tool tip foreach($entries[$dateKey] as $entry) { echo '<div class="has-tooltip"> Event <span class="tooltip">'.$entry.'</span> </div>'; } } ?> </body> </html> I am not getting any errors in the PHP Code Checker (although I am receiving the notice that these functions are now deprecated): mysql_close() mysql_connect() mysql_fetch_array() mysql_query() mysql_real_escape_string() mysql_select_db() When I upload my page to the server, everything seems fine, except that no information is added to the table. When I check the page source, I see this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="css/master.css" type="text/css" media="all"> <meta http-equiv="Content-Type" content="text/html" /> <title>Yet Another Test</title> </head> <body> <div class="calwrapper"> <div class="caltitle"><h1>Calendar</h1></div> <div class="container"> <div class="fnl first"></div> <div class="adjust"></div> <div class="fnl last"></div> </div> <div class="caldisplay"> <table cellspacing="0"> <tr> <td class="hd"><a class="cal_button" href="/1cal/calendar.php?year=2014&month=7"> Prev </a></td> <td colspan="5" class="adjust">August 2014</td> <td class="hd"><a class="cal_button" href="/1cal/calendar.php?year=2014&month=9"> Next </a></td> </tr> <tr> <th class="we">Sun</th> <th class="wd">Mon</th> <th class="wd">Tue</th> <th class="wd">Wed</th> <th class="wd">Thu</th> <th class="wd">Fri</th> <th class="we">Sat</th> </tr> <tr><!--DEBUG: year=$currYear and month=$currMonth<hr/--><td class="hd"> </td><td class="hd"> </td><td class="hd"> </td><td class="hd"> </td><td class="hd"> </td><td class="we" > 1</td> <td class="we" > 2</td> </tr><tr><td class="wd" > 3</td> <td class="wd" > 4</td> <td class="wd" > 5</td> <td class="wd" > 6</td> <td class="wd" > 7</td> <td class="we" > 8</td> <td class="we" > 9</td> </tr><tr><td class="wd" > 10</td> <td class="wd" > 11</td> <td class="wd" > 12</td> <td class="wd" > 13</td> <td class="wd" > 14</td> <td class="we" style='padding: 0px;'> 15</td> <td class="we" > 16</td> </tr><tr><td class="wd" > 17</td> <td class="wd" > 18</td> <td class="wd" > 19</td> <td class="wd" > 20</td> <td class="wd" > 21</td> <td class="we" > 22</td> <td class="we" > 23</td> </tr><tr><td class="wd" > 24</td> <td class="wd" > 25</td> <td class="wd" > 26</td> <td class="wd" > 27</td> <td class="wd" > 28</td> <td class="we" > 29</td> <td class="we" > 30</td> </tr><tr><td class="wd" > 31</td> <td class=\"hd\"> </td><td class=\"hd\"> </td><td class=\"hd\"> </td><td class=\"hd\"> </td><td class=\"hd\"> </td><td class=\"hd\"> </td></tr></table> </div></div></body> </html> I don't have an understanding of what the Debug is telling me although I note the number "1" within the tag and find that interesting because on those occasions, earlier today, when the file upload would result in a white page, viewing the page source would reveal nothing but the numeral "1" in the upper left top. Are the deprecated functions enough to cause the event not to insert into the calendar? I'd appreciate any help in sorting why I'm not succeeding. As you see so often around here, I'm not a coder. I'm just forced into a position to have to fend for myself, as of late, and so I'm trying to learn what I can. Thank you for any help.
  3. There are a couple great threads on SO about how to store complex recurring events for a calendar: Calendar Recurring/Repeating Events - Best Storage Method SQL Infinite Calendar Pattern However these are for storing events that get read at any time. I'm trying to repurpose these storage methods for having scripts run at those times. Once. Reliably. And be run late if they don't run on time. I might have thousands or tens of thousands of events, so I've read that I should not use Apache's Crontab for this. For example, I have a script that needs to send an email to a customer every Tuesday and Thursday at 2PM. Thanks to those threads I now understand how to store that interval, and even how to query for it. What I can't figure out how to reliably only send the email to the customer once. Here's the best solution I've come up with: I run a cron job every minute. It polls the database and finds events that should have run in the last 5 minutes, and that haven't been run in the last 5 minutes. It adds the event to a queue (another table?) to be run by a separate script. It then updates the event record to say it ran now. Issues: If the cron job ever fails, or takes more than 5 minutes, it could miss events that fall outside of the 5 minute window. What if an event is scheduled every 2 minutes? How can I guaranty the event only fires once when scheduled, even if the interval between events is every minute? How would you solve this? Instead of storing the last time it ran, should I calculate and store the next time it should run and just query based on that? Thanks for any help!
  4. Hello, Im having problems using the mysql event function. The query im using is the following: CREATE EVENT newEvent ON SCHEDULE EVERY 1 DAY DO UPDATE orderrader SET vs=1 WHERE order_datum <= DATE_SUB(NOW(), INTERVAL 14 DAY) ; The event is supposed to update the vs-field to one 14 days after the row is written into the database. I checked the table out 15 days after the first row was inserted, but still no update. Thanks alot, Erik
×
×
  • 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.