Jump to content

Alechko

Members
  • Posts

    22
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Alechko's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I didn't fully understand your 3rd suggestion - but thanks anyway, I solved it! thanks!
  2. thanks for the replies, but it stiil don't want to work... This is mySQL: (followed by your comments) $sql = $db->Query("SELECT `users`.`id` AS `userID`, `users`.`registerDate` AS `registerDate`, `users`.`endDate` AS `endDate`, `users`.`fullname` AS `fullName`,`users`.`mobile` AS `mobile`,`entrygym`.`time` AS `time` FROM `users` JOIN `entrygym` ON `users`.`id` = `entrygym`.`userID` [b]WHERE DATE_FORMAT(`entrygym`.`time`,'%Y-%m-%d') BETWEEN CURDATE() - INTERVAL '{$DateString}' DAY AND CURDATE() ORDER BY `entrygym`.`time` DESC"[/b]) or die(mysql_error()); The main problem: I did 8 days interval and it showed me a user who visited at '23/10/2012' and I need the users who didn't visited for 8 days. (The last date from today - 17/10/12) And I understood something: For example, today is the 24/10/12 and user X last visit was at 16/10/12. so I need to count somehow the days between those dates and display if the count over 8,14,31 and so on.
  3. Hello folks, I got a problem with dates and because of it the queries is one big mess. my SQL table look like this: USERS id (auto_increment), name (varchar), birthday(date) and so on.. ENTRIES id (auto_increment), userID (int), time (datetime) I'm trying to display the whole users who didn't entered mysite for 7/14/30 days. I tried to do something like that: $sql = $db->Query(" SELECT `users`.`id` AS `userID`, `users`.`fullname` AS `fullName`.`mobile` AS `mobile`,`entries`.`time` AS `time` FROM `users` JOIN `entries` ON `users`.`id` = `entries`.`userID` WHERE `entries`.`time` BETWEEN CURDATE() AND CURDATE() - INTERVAL 8 DAY") or die(mysql_error()); and It don't show me nothing.. 0 queries. I tried to do something like with 2 queries..: $sql = $db->Query("SELECT `userID`,max(`time`) AS `time` FROM `entires`") or die(mysql_error()); while($row = $db->FetchAssoc($sql)) { . $userID = $row['userID']; $time = date('Y-m-d',strtotime($row['time'])); $sql2 = $db->Query("SELECT `fullName`,`registerDate`,`endDate`,`mobile` FROM `users` WHERE ('{$time}' BETWEEN CURDATE() AND CURDATE() - INTERVAL 8 DAY)") or die(mysql_error()); } But it didn't work too. Help someone? thanks, appriciate it.
  4. Okey thanks, they qurey dosen't working but It seems I get the idea... thanks for the help!
  5. Sorry for the English mistakes, I ment within.. For example: A - 27/09/1980 B - 28/09/1981 C - 29/09/1981 D - 30/09/1981 E - 03/10/1990 Today is the 26th of September. I want to display the users who have a birthday in the next three days. So It will display me: A, B, C. For the whole month it display me all septembers birthday. For the next week it will show me all the letters. Thanks Baranad, The within next 3 days query dosen't worked for me. It didn't show anything. I think I know why, Because I need to compare only the months and days and not the years. Something like that: WHERE `birthdate` BETWEEN [ DAY AND MONTH(`birthday`) ] AND [DAY AND MONTH(`birthday`) ] + INTERVAL 3 DAY I don't know what is the exactly commands for that... thanks for help!! p.s The 'this month' query worked fine for me. SELECT id FROM `users` WHERE MONTH(`birthday`) = MONTH(CURDATE())
  6. Hello folks, I have a little problem with dates. I have stored in my SQL table a 'date' type column as `birthday`. Something like that: (YYYY-MM-DD) 2010-05-10 2008-08-14 2002-03-04 2001-04-19 Now I'm trying to show the birthdays that will occur more 3 days/this week/this month. I know how to display the specific date by: $month = '10'; $day = '22'; $sql = $db->Query("SELECT `id` FROM `users` WHERE DATE_FORMAT(`birthday`,'%m') = '{$month}' AND DATE_FORMAT(`birthday`,'%d') = '{$day}'") or die(mysql_error()); I am aware of the function strtotime. But I need to show all the birthdays that will occur more 3 days including the tomorrow and the day after tomorrow dates.. and I'm a little bit get complex with it. Thanks for the help, appriciate it.
  7. Yes but how I will know to select by dates? to do something like: If '10-10-2010' AND articleID didn't exsits - Insert it... and if exists I need to update the views by one?
  8. Hi folks, I got a little confused about this problem. I am trying to make a views system for my website. I got a 770 rows of articles in my mySQL database and I'm trying to do a views system to know which article got the most views and when. (Today, 3 Days Ago, This week, This month) I tried to do something like this in mySQL database: Table: views ID articleID date But then I don't know how to sum it up? and If I will add column 'views' it wont help me because I have to change the dates all time. amm can someone advice me please? thanks alot!
  9. It works! thanks! Can you recommend me how the best way storage a time in mySQL tables? thanks again!
  10. I wrote this table as an exmaple of unix time. I structred the column 'date' as an INT(11) and inserting into it time(); function according to the time. I'm trying to pull the matches of the specific date. How can pull the data of a specific date? $_POST['selectedDate'] = "22-08-2012"; $chosen = strtotime($_POST['selectedDate']); $sql = $db->Query("SELECT * from `e_leads` WHERE `date` = '{$chosen}'"); thanks.
  11. thanks for the format help, but It dosen't matter which format.. I can't equal the specific date with the date in my MYSQL Tables. $_POST['selectedDate'] = "22-08-2012"; $chosen = strtotime($_POST['selectedDate']); $sql = $db->Query("SELECT * from `e_leads` WHERE `date` = '{$chosen}'"); The equal sign dosen't working. But if I will do the '>' It will show me the next days after the 'chosen' date. But If I want the chosen date specificaly?
  12. Hello folks, I have a little problem with date: The MYSQL Table is going like this: ID Text Date (Unixtime - time()); 1 Text #1 123121231 2 etww 545465454 3 t4tt 255255222 I have the date in this format: $selectedDate = dd-mm-yy. and I want to do something like this: $db->Query("SELECT * from `table` WHERE `date` = '{$selectedDate}'"); I tried with strtotime but It didn't worked. thanks.
  13. Hello guys, I have 2 functions that I wrote in JS: function changePrice(divId, sId, price) { document.getElementById(divId).innerHTML = price * document.getElementById(sId).value + ' ₪'; } function changeTotal(id1,id2) { var a = document.getElementById(id1).value; var b = document.getElementById(id2).value; document.getElementById('totalSum').innerHTML = Number(a); } This is the HTML Code: <div class="protitle"> Sum </div> <div class="protitle"> Price </div> <div class="protitle"> Quanity </div> <div class="product-title"> <img src="colors/G.gif" alt=" /> <a href="#" title="#" style="font-size:15px;text-decoration:underline;"> <span style="font-weight:bold;"> Printer </span> HP 51626A </a> </div> <div class="product-sum" id="sum-1"> 1027 ₪</div> <div class="product-price"> 678 ₪</div> <div class="product-quanity"> <form> <select id="selectQuan-1" onChange="changePrice('sum-1','selectQuan-1','678');changeTotal('sum-1','sum-2');"> <option value="1" checked>1</option> <option value="2" checked>2</option> <option value="3" checked>3</option> <option value="4" checked>4</option> <option value="5" checked>5</option> </select> </form> </div> <div class="product-title"> <img src="colors/R.gif" alt=" /> <a href="#" title="#" style="font-size:15px;text-decoration:underline;"> <span style="font-weight:bold;"> Printer </span> HP 51626A </a> </div> <div class="product-sum" id="sum-2"> 1027 ₪</div> <div class="product-price"> 678 ₪</div> <div class="product-quanity"> <form> <select id="selectQuan-2" onChange="changePrice('sum-2','selectQuan-2','678');changeTotal('sum-1','sum-2');"> <option value="1" checked>1</option> <option value="2" checked>2</option> <option value="3" checked>3</option> <option value="4" checked>4</option> <option value="5" checked>5</option> </select> </form> </div> <div class="totalSum" id="totalSum"> </div> I am trying to update automatically the sum in the page. the first function the summing up only the product - working fine. but when I'm trying to TotalSum it gives me an error with 'NaN'. I tried to use the parseInt() function and the Number().. but still the 'NaN' pops to me. help someone? Appriciate it. thanks.
  14. man, you are awesome. It worked like a magic. thanks.
×
×
  • 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.