-
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
3,163 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.
-
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:
-
Get Correct MySql Data Before and After Certain Date
cutielou22 replied to cutielou22's topic in PHP Coding Help
Alright, here you are - I removed the first 3 id's, but that shouldn't matter: -- -- Table structure for table 'bom_transaction' -- CREATE TABLE bom_transaction ( id int(11) unsigned NOT NULL AUTO_INCREMENT, account int(7) unsigned NOT NULL, `type` tinyint(1) unsigned NOT NULL DEFAULT '0', amount decimal(5,2) unsigned NOT NULL, reason varchar(250) COLLATE latin1_general_ci NOT NULL, repayplan tinyint(1) unsigned NOT NULL, repaid tinyint(1) unsigned NOT NULL, transid varchar(40) COLLATE latin1_general_ci NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=10 ; -- -- Dumping data for table 'bom_transaction' -- INSERT INTO bom_transaction (id, account, `type`, amount, reason, repayplan, repaid, transid, `date`) VALUES(4, 567892, 1, '10.00', '', 0, 0, '', '2013-01-25 02:58:59'); INSERT INTO bom_transaction (id, account, `type`, amount, reason, repayplan, repaid, transid, `date`) VALUES(5, 567892, 1, '10.00', '', 0, 0, '', '2013-02-01 02:59:20'); INSERT INTO bom_transaction (id, account, `type`, amount, reason, repayplan, repaid, transid, `date`) VALUES(6, 567892, 1, '90.00', '', 0, 0, '', '2013-02-06 02:59:38'); INSERT INTO bom_transaction (id, account, `type`, amount, reason, repayplan, repaid, transid, `date`) VALUES(7, 567892, 1, '20.00', '', 0, 0, '', '2013-02-20 02:59:51'); INSERT INTO bom_transaction (id, account, `type`, amount, reason, repayplan, repaid, transid, `date`) VALUES(8, 567892, 2, '46.00', 'Vengenz Birthday Party/T-Shirts', 1, 0, '', '2013-02-23 03:00:19'); INSERT INTO bom_transaction (id, account, `type`, amount, reason, repayplan, repaid, transid, `date`) VALUES(9, 567892, 1, '100.00', '', 0, 0, '', '2013-03-06 03:00:41');- 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
$timeframe is not the only one that is different. Both $timeframe and $money are different. Compare my examples of results more closely to get a better understanding. By the way, there is not 1 row. Right now there is 2 rows in the table - and in the near future there will be more.- 13 replies
-
- mysql date
- before and after
-
(and 3 more)
Tagged with:
-
How about you try not having the mail() command as a variable. Like below: <?php //simple captcha if(isset($_POST['answer']) && $_POST['answer']!='14') { echo "<script>alert('You provided a wrong answer for the Security Question')</script>"; echo "<a href='contact.php'>Please return to the Form and try again.</a><br /><br />\n"; //simple captcha $field_name = $_POST['name']; $field_email = $_POST['email']; $field_phone = $_POST['phone']; $field_preferred = $_POST['preferred']; $field_datepicker = $_POST['datepicker']; $field_passengers = $_POST['passengers']; $field_pickup = $_POST['pickup']; $field_drop = $_POST['drop']; $field_message = $_POST['message']; if(!ereg("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $field_email)) { echo "That is not a valid <b>email</b> address. Please return to the" . " <a href='contact.php'>previous page and try again.</a>"; exit; } if(empty($_POST['name']) || strlen(trim($_POST['name'])) ==0) { echo "Your <b>name</b> was not entered into the field. Please return to the" . " <a href='contact.php'>previous page and try again.</a>"; } else if(empty($_POST['email']) || strlen(trim($_POST['email'])) ==0) { echo "Your <b>email</b> was not entered into the field. Please return to the" . " <a href='contact.php'>previous page and try again.</a>"; } else if(empty($_POST['message']) || strlen(trim($_POST['message'])) ==0) { echo "You <b>message</b> was not entered into the field. Please return to the" . " <a href='contact.php'>previous page and try again.</a>"; } else if(empty($_POST['pickup']) || strlen(trim($_POST['pickup'])) ==0) { echo "Your <b>pickup</b> location was not entered into the field. Please return to the" . " <a href='contact.php'>previous page and try again.</a>"; } else if(empty($_POST['drop']) || strlen(trim($_POST['drop'])) ==0) { echo "Your <b>drop off</b> location was not entered into the field. Please return to the" . " <a href='contact.php'>previous page and try again.</a>"; } else { $mail_to = '[email protected]'; $subject = 'New Message from '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$field_email."\n"; $body_message .= 'Phone: '.$field_phone."\n"; $body_message .= 'Preferred Method: '.$field_preferred."\n"; $body_message .= 'Appointment Date: '.$field_datepicker."\n"; $body_message .= 'Number of Passengers: '.$field_passengers."\n"; $body_message .= 'Pick Up Location: '.$field_pickup."\n"; $body_message .= 'Drop Off Location: '.$field_drop."\n"; $body_message .= 'Message: '.$field_message."\n"; $headers = 'From: '.$field_email."\r\n"; $headers .= 'Reply-To: '.$field_email."\r\n"; if (mail($mail_to, $subject, $body_message, $headers)) { ?> <script language="javascript" type="text/javascript"> alert('Thank you for the message. We will contact you shortly.'); window.location = 'index.htm'; </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('Message failed. Please, send an email to techsuppor'); window.location = 'index.htm'; </script> <?php } } } ?> Let me know if it works!
-
Try: require_once ('connection.php'); //First Query and Output $result = mysql_query("CALL C01_Client_Summary_ByAccount(1, '2012-02-27', '2013-03-29');"); while($row=mysql_fetch_array($result)) { echo $row['CommisionPercentage']; } //END First Query and Output //Second Query and Output $new2 = mysql_query("CALL C01_Client_Summary_ByBetType(1, '2012-02-27', '2013-03-29');"); while($row2=mysql_fetch_array($new2)) { echo $row2['Turnover']; } //END Second Query and Output I changed the 2nd query's variable by adding a "2" behind it.
-
I need some help with the following code. I want it to go through the "bom_terms" table in which $money and $timeframe should be found based on the start date and end date comparisons I am having trouble with. Full Transactions code: /* Transactions */ echo "<h2>Transactions - <a href=\"../transactions/add.php?account=$account\">Add</a></h2>"; if($stmt = $mysqli->prepare("SELECT type, amount, reason, repayplan, repaid, transid, date FROM bom_transaction WHERE account = ? ORDER BY id")); { $stmt->bind_param('i', $account); $stmt->execute(); $stmt->store_result(); $count = $stmt->num_rows; $stmt->bind_result($type, $amount, $reason, $repayplan, $repaid, $transid, $date); if ($count == "0") { echo "<i>No transactions were found.</i><br>"; } while ($stmt->fetch()){ if ($type == "0") {$type = ""; $color = "";} if ($type == "1") {$type = "Added"; $color = "green";} if ($type == "2") {$type = "Removed"; $color = "red";} if ($type == "3") {$type = "Repaid"; $color = "";} if ($repayplan == "0") {$repayplan = "No";} if ($repayplan == "1") {$repayplan = "Yes";} if ($repaid == "0") {$repaid = "No";} if ($repaid == "1") {$repaid = "Yes";} $stmt2 = $mysqli->prepare("SELECT money, timeframe FROM bom_terms WHERE account = ? AND startdate <= '2013-01-03 21:00:00' AND enddate >= '2013-02-20 21:00:00'"); $stmt2->bind_param('i', $account); $stmt2->execute(); $stmt2->store_result(); $stmt2->bind_result($money, $timeframe); $stmt2->fetch(); $stmt2->close(); $date2 = date("M d, Y", strtotime($date)); echo "<font color=\"$color\">$type $$amount</font> $money/$timeframe $reason $repayplan $repaid $date2 <a href=\"../transactions/edit.php?transid=$transid\">Edit</a><br>"; } $stmt->close(); } echo "<br>"; Part of Coding Asking About (From the above): $stmt2 = $mysqli->prepare("SELECT money, timeframe FROM bom_terms WHERE account = ? AND startdate <= '2013-01-03 21:00:00' AND enddate >= '2013-02-31 21:00:00'"); $stmt2->bind_param('i', $account); $stmt2->execute(); $stmt2->store_result(); $stmt2->bind_result($money, $timeframe); $stmt2->fetch(); $stmt2->close(); What's it's doing: It's making all results from the "bom_terms" table the same when at least 2 of the results should be different (meaning from a different row of the "bom_terms" table). - Right now it is grabbing the last result found from the table. Not sure why however. Some tests/theories I tried made it so it did show a different row, but they were still all shown as the same. Example (what it is doing now): ---Example--- Added $10.00 40.00/Every 2 Weeks No No Jan 31, 2013 Edit Added $90.00 40.00/Every 2 Weeks No No Feb 05, 2013 Edit Added $20.00 40.00/Every 2 Weeks No No Feb 19, 2013 Edit Removed $46.00 40.00/Every 2 Weeks Vengenz Birthday Party/T-Shirts Yes No Feb 22, 2013 Edit Added $100.00 40.00/Every 2 Weeks No No Mar 05, 2013 Edit ---END Example--- NOTE: The 40.00/Every 2 Weeks is the result from the "bom_terms" table. Example (what I want it to do): ---Example--- Added $10.00 20.00/Every Week No No Jan 31, 2013 Edit Added $90.00 20.00/Every Week No No Feb 05, 2013 Edit Added $20.00 20.00/Every Week No No Feb 19, 2013 Edit Removed $46.00 40.00/Every 2 Weeks Vengenz Birthday Party/T-Shirts Yes No Feb 22, 2013 Edit Added $100.00 40.00/Every 2 Weeks No No Mar 05, 2013 Edit ---END Example--- NOTE: The 40.00/Every 2 Weeks and 20.00/Every Week are the results that would be from the "bom_terms" table. I am hoping there is just a simple problem/error I don't see. .. . . Hopefully you can understand what I am asking and having trouble with - I had a hard time trying to come up with a good way to explain it - this is the best way I could come up with.
- 13 replies
-
- mysql date
- before and after
-
(and 3 more)
Tagged with: