PHP - Moved: Weekly Sum(clicks)
This topic has been moved to MySQL Help.
http://www.phpfreaks.com/forums/index.php?topic=321849.0 Similar TutorialsHi everyone I need some help on how to go about designing a script for a high school. It is for teachers so that they can book periods for the computer lab, studio etc. I want it so when they go to the page it has this week with all the slots taken. What I'm having trouble with is I want them to also be able to go to any date they wish and bring up that weeks schedule because they need to be able to book in advance. Would anyone be able to explain a technique on how I can go about this Thanks in advance I have a need for the execution of a script on a weekly basis. In this instance, I need the PHP script to start executing every Monday at 00:00:01 (very first second of the week). How can I achieve this?? I have jobs portal where registered users posts new jobs searches
This weekly newsletter will send all the jobs posted in the site (in a week) to the registered users but in a more personalized way: For example, posted jobs looking for designers should be sent to users registered as designers.
what is the best way to do this? any recommendations? Thanks in advance.
How would I reset a counter every 7 days? I already have a table with a date created field. I just need to reset a counter every 7 days - say Monday morning at 1am or whatever time sets the new day. It has to be after a week, every week. The other counter can go up to 10 but must reset to 0 after 7 days. This is a voting system where the logged in person can vote up to 10 times in a week, but no more than 10 times. I have the votecount stored in a field as well as totalvotes. The votecount is the counter that goes up to 10 for each logged user. The username of the voter is also stored to tie them to their user account. Everything is done and working except for this. I would rather do this in php if possible, but I am open to mysql queries if there is no other way. Thanks for any help. Mike Hi, I wanted to know if it is possible to have multiple contact forms on my blog that basically send questions to different email accounts, but also have a limit of say 5 emails per week to each account. After the limit of 5 has been sent for that week I can display a message stating the weekly limit has been reached. I need to this as I am trying to an experts Q&A section but the experts only agree to 5 emails every week and don't want any more emails than that. I was thinking about using the Contact Form 7 plugin for Wordpress for the multiple email accounts bit but don't really know how to do the weekly limit. Any help with how to do so would be much appreciated. Thanks Hi all, i am creating a custom blog for practise, how do we add no of clicks in database to that topics visitors clicks. I have added 'clicks' field in table 'blog_posts'. Now how to add and increment value by 1 when visitors visits that topic ? Alright more on my affiliate page which you guys helped me build last night. Thanks again I want to count the number of times one of the affiliates is clicked. So each one has to have its own impression number. I have my array set up like so: - i see that impression is now 0 and needs to be changed to a variable etc like $aff_blah1_impressions // affiliates array for affiliates page $affiliates = array( array( "title" => "aff_blah1", "image" => "http://aff_blah1.net/images/aff_blah1.png", "href" => "http://aff_blah1.net/", "start_date" => "1/1/2011", "impressions" => "0" ), array( "title" => "aff_blah2", "image" => "http://aff_blah2.net/images/aff_blah2.png", "href" => "http://aff_blah2.net/", "start_date" => "1/1/2011", "impressions" => "0" ), array( "title" => "aff_blah3", "image" => "http://aff_blah3.net/images/aff_blah3.png", "href" => "http://aff_blah3.net/", "start_date" => "1/1/2011", "impressions" => "0" ), ); // affiliates array end I have seen some examples but they all use a text file. Is there any way to have it stored in the database? I was thinking it would somehow be in the link with like a onClick (which is java) that would run a php function. What i am trying to figure out is the best way to store it and have only one function for impressions made on each affiliate. Any keyword search terms or links would be very helpful! Can also contact through AIM: MadLittleMods@gmail.com Hello PHPFreaks, I have emerged yet again with another question. I currently have a fully operational Minecraft Voting for Diamonds script (Don't turn away because you saw Minecraft, this has nothing to do with it), and want to enhance it; though a 'Top Voters' list. Now, basically the script goes like this Login Page > Main Page with links > Rewarding Script > thank you message. On the main page with links, once all links are clicked on, you click a 'Get Rewarded' button. I want to track who clicks this, and how many times a month it is clicked by them. Only 1 click on the button is allowed per day, with the use of cookies. This means the maximum amount of clicks on it per month, per user would be something around 30. I store the players usernane in the cookies, and if they have voted today, but that is all. The Top Voters list would look something like this: Userwhatever - 6 Votes Blarg - 4 votes Someone - 2 votes And so on... I want an ordered list of users which have voted that month. 'Votes', would be the amount of times that 'Get Rewarded' had been clicked. How can I make this? I will also require it to reset all votes of the first of every month, how do I do this? Many thanks! How can I make a link or banner to expire after x number of clicks on it? Hey all, THe problem I am having is even when I check the checbox, it still sends a value of 0 to the php array and hence nothing is ever updated: Code: [Select] <input type="checkbox" name="approved[1]" value="1" checked="checked" /> <input type="checkbox" name="approved[3]" value="0" /> <input type="checkbox" name="approved[4]" value="0" /> So the second item is not checked by default. But even when I check it, my post array contains this: Code: [Select] array(2) { [1]=> string(1) "1" [3]=> string(1) "0" } Notice the "0". It should be "1" now since I checked the second option. This is the function: Code: [Select] function update(){ $vanity_url = new VanityUrl(); $checkbox = $this->input->post('approved'); //this is same thing as $_POST if(isset($checkbox)){ foreach($checkbox as $key => $value){ $vanity_url->where('id',$key)->get(); $vanity_url->approved = (int)$value; $vanity_url->save(); $vanity_url->check_last_query(); } } } That check_last_query() function outputs this: Code: [Select] UPDATE `vanity_urls` SET `approved` = 1 WHERE `id` = 1 UPDATE `vanity_urls` SET `approved` = 0 WHERE `id` = 3 So despite checking the second option it still sets it to 0. Thanks for response. Can you see any problems with the code below? It doesn't work. What I am trying to do is quite straightforward. The links on my site look like this: go.php?id=1&url=usa go.php?id=1&url=uk go.php?id=2&url=usa go.php?id=2&url=uk When a visitor clicks on one of these links, I want to grab the values of the id and url parameters, count the click, and redirect the visitor. Here's the error that I get when I try the code: Quote Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\sites\go.php on line 18 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\sites\go.php:18) in C:\xampp\htdocs\sites\go.php on line 19 <?php $conn = mysql_connect('localhost','username', 'password') or trigger_error("SQL", E_USER_ERROR); mysql_select_db('database', $conn) or trigger_error("SQL", E_USER_ERROR); $id = intval($_GET['id']); $url = intval($_GET['url']); mysql_query("UPDATE urls SET click_counter = click_counter+1 WHERE id=$id"); if ($url=="usa") $href = "SELECT usa FROM urls WHERE id=$id"; elseif ($url=="uk") $href = "SELECT uk FROM urls WHERE id=$id"; elseif ($url=="aus") $href = "SELECT aus FROM urls WHERE id=$id"; elseif ($url=="can") $href = "SELECT can FROM urls WHERE id=$id"; else $href = "SELECT int FROM urls WHERE id=$id"; $qry = mysql_query($href); list($href)=mysql_fetch_row($qry); header("Location:$href"); mysql_close($conn); ?> I want to recieve emails on weekly manner from thursday to thursday. For this how can i set the variables to pass to the sql query. I worte this $start_date = mktime(0, 0, 1, date("m"), date("j")-7, date("Y")); but it will calculate date from today. And I want to recieve emails on every friday morning. So please write the code for me also write the end date. Thanks in advance. This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=328845.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=328917.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=309960.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=328753.0 This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=345722.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=317014.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=315910.0 This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=331097.0 |