-
Posts
81 -
Joined
-
Last visited
About cutielou22
- Birthday 07/22/1993
Contact Methods
-
Website URL
https://mandyjosmith.com
Profile Information
-
Gender
Female
-
Location
USA
-
Interests
Programming, music, games, tv.
Recent Profile Visitors
2,861 profile views
cutielou22's Achievements
-
Well, I want to make it so a user can have there own events and they show up in the calendar. The calendar you can "flip" through the months to look at the months coming up. I want the days of events to be highlighted a certain color. Since you say my " ajax code sends the date": then how do I grab that information and compare it with the calendar? That is what I don't get.
-
So I added data-day, but that must up all dates in the calendar. What would data-day be linked to - I have nothing called that right now. Is the ajax I have now correct then (and in the correct spot)? - is json_encode() correct also? I am completely new to this. Just using Google.
-
Okay. So I have done only ajax forms. So I am getting a little confused while researching . . . what I have added: Underneath: generateCalendar(currentDate); I added (still in the same function as generateCalendar - not sure if correct either): $.ajax({ type: "POST", dataType: 'json', url: "cal_events.php", async: false, data: {date: currentDate}, contentType: "application/json; charset=utf-8", success: function (msg) { console.log(msg); } }); Then I created the page cal_events.php with this code: $share_with = user_shared($user); $stmt2 = $mysqli->prepare("SELECT date, status FROM pto_tracker WHERE account = ? ORDER BY date"); $stmt2->bind_param('i', $share_with); $stmt2->execute(); $stmt2->store_result(); $count = $stmt2->num_rows; $stmt2->bind_result($date, $status); $stmt2->fetch(); $stmt2->close(); $current_date = cleansafely($_POST['date']); if (($count >= 1) && ($current_date == $date)){ if ($status == "pending") { $background_color = "#f0cb11"; $status_show = "<span class=\"label plain\">Pending</span>"; } if ($status == "approved") { $background_color = "#4CAF50"; $status_show = "<span class=\"label green\">Approved</span>"; } if ($status == "denied") { $background_color = "#c62d1f"; $status_show = "<span class=\"label red\">Denied</span>"; } $array .= $date . $status_show; } $out = array_values($array); json_encode($out); //echo json_encode($array, JSON_FORCE_OBJECT); I am not sure how to go about actually finding the dates on the calendar to the ones in table.
-
I have a javascript calendar and I want to make it so when a event is added to a mysql table it can be seen on the calendar. I know you can't put SELECT and other mysql stuff in a script so how can I do this? HTML: <div id="main" class="container"> <span class="jumbotron"> <h1 class="text-center"> <a id="left" href="#"> <i class="fas fa-chevron-left"></i> </a> <span id="month"></span> <span id="year"></span> <a id="right" href="#"> <i class="fas fa-chevron-right"></i> </a> </h1> </span> <span class="row"> <span class="col-sm-10 col-sm-offset-1"></span> </span> <table class="table"></table> </div> JAVASCRIPT for calendar: $(document).ready(function() { var currentDate = new Date(); function generateCalendar(d) { function monthDays(month, year) { var result = []; var days = new Date(year, month, 0).getDate(); for (var i = 1; i <= days; i++) { result.push(i); } return result; } Date.prototype.monthDays = function() { var d = new Date(this.getFullYear(), this.getMonth() + 1, 0); return d.getDate(); }; var details = { // totalDays: monthDays(d.getMonth(), d.getFullYear()), totalDays: d.monthDays(), weekDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], }; var start = new Date(d.getFullYear(), d.getMonth()).getDay(); var cal = []; var day = 1; for (var i = 0; i <= 6; i++) { cal.push(['<tr>']); for (var j = 0; j < 7; j++) { if (i === 0) { cal[i].push('<td>' + details.weekDays[j] + '</td>'); } else if (day > details.totalDays) { cal[i].push('<td> </td>'); } else { if (i === 1 && j < start) { cal[i].push('<td> </td>'); } else { cal[i].push('<td class="day">' + day++ + '</td>'); } } } cal[i].push('</tr>'); } cal = cal.reduce(function(a, b) { return a.concat(b); }, []).join(''); $('table').append(cal); $('#month').text(details.months[d.getMonth()]); $('#year').text(d.getFullYear()); $('td.day').mouseover(function() { $(this).addClass('hover'); }).mouseout(function() { $(this).removeClass('hover'); }); } $('#left').click(function(e) { $('table').text(''); if (currentDate.getMonth() === 0) { currentDate = new Date(currentDate.getFullYear() - 1, 11); generateCalendar(currentDate); } else { currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth() - 1) generateCalendar(currentDate); } e.preventDefault(); }); $('#right').click(function(e) { $('table').html('<tr></tr>'); if (currentDate.getMonth() === 11) { currentDate = new Date(currentDate.getFullYear() + 1, 0); generateCalendar(currentDate); } else { currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1) generateCalendar(currentDate); } e.preventDefault(); }); generateCalendar(currentDate); }); Not sure if needed, but I provided all the code. For the sake of my question lets say I have database table called "current_events" and I want to show all events on the calendar in a different color.
-
I never had this problem before though. I don't know what started it. Not sure what I changed to effect it.
-
Okay . . . . but do you know why I am getting this error or what I can do to fix it (besides switching my entire site to ajax)? It also sometimes throws in a 406 Not Acceptable The server cannot send data in a format requested.
-
For example, if they just won a game and received a trophy for it. It takes them to a page to update the database with the trophy they just won and perhaps their score. It then redirects immediately back to the game in a die(header(Location: link.com/here.php?note=You+won+a+trophy.+<img src=trophylink.png>)).
-
I want it show something like "You found this *item here*." and have it show a picture with it - without the page messing with my layout. Is that bad or something?
-
Here is a example link: https://site.com/this_here/page.php?note=W+srchttp:>e+have+some+text+here. That shows up fine like it is supposed to, but when I want a image to show up with in it - in html - it makes the whole page wonky. Example Problem: https://site.com/this_here/page.php?note=We+have+some+text+here.+<img src=imagelink.png> I have it on any page that is now set to show an image link that. I used to not have problems with this and now I do. The 'note' text comes from a $_GET and is not decoded or anything - which you shouldn't do I know. I tested by taking out one "<" thinking that was the problem. And that made it so the page wasnt wonky but then you know just the text appeared. I also tested leaving in both "<>" from the img tag and taking out the "=". That also makes it so the page isnt wonky anymore. Does just the same as taking out a "<>". This seems like a really weird error to me, but maybe there is something I should or shouldn't be doing that I am not thinking of.
-
You should be using bind_param. Instead of . . $stmt->bind("ss",$description,$name) or die( "could not bind parameters"); Use . . . $stmt->bind_param("ss",$description,$name) or die( "could not bind parameters");
-
Not sure what is going on I tried everything (well, that I could think of) . . . any ideas are welcome (hopefully new ones - getting frustrated :/) if ($mysqli->prepare("INSERT INTO solcontest_entries (title, image,content, user, contest) VALUES ($title, $image, $content, $userid, $contest")) { $stmt2 = $mysqli->prepare("INSERT INTO `solcontest_entries` (title, image, content, user, contest) VALUES (?, ?, ?, ?, ?)"); $stmt2->bind_param('sssss', $title, $image, $content, $userid, $contest); $stmt2->execute(); $stmt2->store_result(); $stmt2->fetch(); $stmt2->close(); } else { die(mysqli_error($mysqli)); } Error I get from die mysqli_error: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' of the site's lead ad, user_61609201, contest_1' at line 1" I have also tried $mysqli->query no change occured. I added the "if else die" statement because it was giving no errors, but not adding it to the database. It gives the error where $content is supposed to be inserted. Various combos and singles I tried for the variable: //$content = cleansafely($_POST['content']); //$content = mysqli_real_escape_string ($mysqli, $_POST['content']); //$content = cleansafely($content); $content = $_POST['content']; If any more information is needed please let me know.
- 1 reply
-
- insert into
- mysqli
-
(and 3 more)
Tagged with:
-
Get Correct MySql Data Before and After Certain Date
cutielou22 replied to cutielou22's topic in PHP Coding Help
Yes thank you. It is working perfectly now. Sorry about not posting my attempt. (Noted for next time.)- 13 replies
-
- mysql date
- before and after
-
(and 3 more)
Tagged with:
-
Get Correct MySql Data Before and After Certain Date
cutielou22 replied to cutielou22's topic in PHP Coding Help
I am guessing you already went to sleep. But it is not urgent. No rush needed.- 13 replies
-
- mysql date
- before and after
-
(and 3 more)
Tagged with:
-
Get Correct MySql Data Before and After Certain Date
cutielou22 replied to cutielou22's topic in PHP Coding Help
Yes, that is the result I wanted - I have yet to test your code though. I will let you know tonight or tomorrow if it works for me. EDIT: Could you convert it back over to mysqli? I tried changing it myself, but I am not getting the same results as you.- 13 replies
-
- mysql date
- before and after
-
(and 3 more)
Tagged with:
-
Get Correct MySql Data Before and After Certain Date
cutielou22 replied to cutielou22's topic in PHP Coding Help
Opps. My bad. Here you go: -- -- Table structure for table `bom_terms` -- CREATE TABLE `bom_terms` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `account` int(7) unsigned NOT NULL, `money` decimal(5,2) NOT NULL, `timeframe` varchar(100) COLLATE latin1_general_ci NOT NULL, `startdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `enddate` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=3 ; -- -- Dumping data for table `bom_terms` -- INSERT INTO `bom_terms` (`id`, `account`, `money`, `timeframe`, `startdate`, `enddate`) VALUES(1, 567892, '20.00', 'Every Week', '2013-01-04 00:44:51', '2013-02-06 12:33:26'); INSERT INTO `bom_terms` (`id`, `account`, `money`, `timeframe`, `startdate`, `enddate`) VALUES(2, 567892, '40.00', 'Every 2 Weeks', '2013-02-06 17:34:34', '0000-00-00 00:00:00');- 13 replies
-
- mysql date
- before and after
-
(and 3 more)
Tagged with: