Jump to content

demeritrious

Members
  • Posts

    30
  • Joined

  • Last visited

demeritrious's Achievements

Member

Member (2/5)

0

Reputation

  1. That method did not work with my current insert statement. If i can get this Update multiple records query working then all would be well for me. I would also like to make that work in a page that I will make in the future that requires multiple records to be updated. Any suggestions on how I can get the code that I posted earlier to work? I've even tried a foreach loop still no luck. Thank you for helping
  2. I feel like this should be easy but I am stuck. I am attempting to create a form that will dynamically update rows using radiobuttons selected by the user. It is a questionnaire. Next will be figuring out the best way to use pagination and update only the records displayed on that page. Thanks in advanced Assessment.php <form action="Process/Process.php" method="post"> <?php do { ?> <label><?php echo $row_Questions['Questions']; ?></label> <label> <input <?php if (!(strcmp($row_Questions['Value'],"1"))) {echo "checked=\"checked\"";} ?> type="radio" name="Value[<?php echo $row_Questions['QuestionID']; ?>]" class="icheck" data-radio="iradio_square-blue" value="1"> Strongly Disagree </label> <label> <input <?php if (!(strcmp($row_Questions['Value'],"2"))) {echo "checked=\"checked\"";} ?> type="radio" name="Value[<?php echo $row_Questions['QuestionID']; ?>]" class="icheck" data-radio="iradio_square-blue" value="2"> Disagree </label> <label> <input <?php if (!(strcmp($row_Questions['Value'],"3"))) {echo "checked=\"checked\"";} ?> type="radio" name="Value[<?php echo $row_Questions['QuestionID']; ?>]" class="icheck" data-radio="iradio_square-blue" value="3"> Neutral </label> <label> <input <?php if (!(strcmp($row_Questions['Value'],"4"))) {echo "checked=\"checked\"";} ?> type="radio" name="Value[<?php echo $row_Questions['QuestionID']; ?>]" class="icheck" data-radio="iradio_square-blue" value="4"> Agree </label> <label> <input <?php if (!(strcmp($row_Questions['Value'],"5"))) {echo "checked=\"checked\"";} ?> type="radio" name="Value[<?php echo $row_Questions['QuestionID']; ?>]" class="icheck" data-radio="iradio_square-blue" value="5"> Strongly Agree </label> <input type="hidden" name="AnswerID[]" value="<?php echo $row_Questions['AnswerID']; ?>"> <input type="hidden" name="QuestionID[]" value="<?php echo $row_Questions['QuestionID']; ?>"> <input type="hidden" name="UserID[]" value="User"> <?php } while ($row_Questions = mysql_fetch_assoc($Questions)); ?> <input type="submit" name="ValueAssessmen" value="Submit"> </form> Process.php if(isset($_POST['ValueAssessment'])) { $AnswerID = count($_POST['AnswerID']); $i = 0; while ($i < $AnswerID) { $AnswerID= $_POST['AnswerID'][$i]; $Value= $_POST['Value'][$i]; $QuestionID= $_POST['QuestionID'][$i]; $UserID= $_POST['UserID'][$i]; $query = "UPDATE answer SET Value = '$Value', QuestionID = '$QuestionID', UserID = '$UserID' WHERE AnswerID = '$AnswerID'"; mysql_query($query) or die ("Error in update query: $query"); ++$i; } }
  3. Good evening, I am working on a query at my office that is joining multiple tables in order to display a User notification (similar to facebook). The notifications are based on user department, access level, and position. I want to display all of the announcements filtered for the user that is in the CWAnnouncement table and the NotificationArchive Table where the NotificationArchive.Active is equal to 1 or if they have not made an entry in the NotificationArchive table. If NotificationArchive.Active is equal to 0 then I do not want it to show up in the query results. So far the user filter works but I am having trouble display the results based on who the user is and whether or not they have an announcement in the NotificationArchive table. I hope this make sense. Help would be greatly appreciated this will be my first major project for this company and I want to do a good job for them. Thanks, SELECT ROW_NUMBER() OVER(ORDER BY StartDate DESC) AS 'Rownumber', dbo."User".USERID, CWNotifications.* FROM dbo."User" LEFT JOIN ( SELECT dbo.CWAnnouncements.AnnouncementID, dbo.CWAnnouncements.Title, dbo.CWAnnouncements.Message, dbo.CWAnnouncements.StartDate, dbo.CWAnnouncements.EndDate, dbo.CWAnnouncements.AllStaff, dbo.CWAnnouncements.MGR, dbo.CWAnnouncements.L504, dbo.CWAnnouncements.AdminSupport, dbo.CWAnnouncements.EXP, dbo.CWAnnouncements.IT, dbo.CWAnnouncements.Legal, dbo.CWAnnouncements.PSA, dbo.CWAnnouncements.SRV, dbo.CWAnnouncements.QC, dbo.CWAnnouncements.Active, dbo.CWAnnouncements.UserID, dbo.CWAnnouncements.LS, dbo.CWAnnouncements.LSA, dbo.CWAnnouncements.FileRoom, dbo.CWAnnouncements.Collateral, NotificationArchive.NotificationID, NotificationArchive.Active AS ActiveNote FROM dbo.CWAnnouncements Left JOIN dbo.NotificationArchive ON dbo.CWAnnouncements.AnnouncementID=dbo.NotificationArchive.AnnouncementID WHERE (dbo.NotificationArchive.UserID='#GetAuthUser()#' AND dbo.CWAnnouncements.Active=1 AND dbo.NotificationArchive.UserID IS NULL) OR dbo.CWAnnouncements.UserID='#GetAuthUser()#' AND dbo.NotificationArchive.UserID='#GetAuthUser()#' AND dbo.CWAnnouncements.Active=1 AND dbo.NotificationArchive.Active = 1 ) CWNotifications ON (dbo."User".MGR>=CWNotifications.MGR AND CWNotifications.MGR >=1 OR dbo."User".QC>=CWNotifications.QC AND CWNotifications.QC >=1 OR dbo."User".IT>=CWNotifications.IT AND CWNotifications.IT >=1 OR Dbo."User".LEG>=CWNotifications.Legal AND CWNotifications.Legal >1 OR (dbo."User".AdminSupport=CWNotifications.AdminSupport AND CWNotifications.AdminSupport = 1 OR dbo."User".Fileroom=CWNotifications.Fileroom AND CWNotifications.Fileroom = 1 OR dbo."User".Collateral=CWNotifications.Collateral AND CWNotifications.Collateral = 1) OR (dbo."User".L504>=CWNotifications.L504 AND CWNotifications.L504 >= 1 or dbo."User".EXP>=CWNotifications.EXP AND CWNotifications.EXP >= 1 or dbo."User".SRV>=CWNotifications.SRV AND CWNotifications.SRV >= 1 or dbo."User".PSA>=CWNotifications.PSA AND CWNotifications.PSA >= 1) AND (dbo."User".LS=CWNotifications.LS AND CWNotifications.LS = 1 OR dbo."User".LSA=CWNotifications.LSA AND CWNotifications.LSA = 1) OR CWNotifications.AllStaff=1) AND CWNotifications.Active=1 WHERE (dbo."user".USERID='#GetAuthUser()#') ORDER BY StartDate DESC
  4. If the user has multiple bills due on the same day. Is there a way to loop the bill name inside the email?
  5. Great it worked thank you very much! My last question is how can I loop $billname inside the email?
  6. Forgive me I feel dumb. I tried adding $Firstname = $row['firstname'] after the $mail_to Then adding function sendEmail($mail_to, $Firstname) It's still not pulling up in the email. What am I missing?
  7. I believe the solution the my problem should be simple I feel that it's staring me right in the face. I have a Cron Job that sends an email message to users who's bill "due date" falls on the current date. I want to make the email more personalized and say: Dear John Doe: You have the following bills due today: Rent Cable Internet Please login to pay your bills Thanks,. Here's my following PHP code <?php header("Content-type: text/plain"); // OPEN DATA BASE define("HOSTNAME","localhost"); define("USERNAME",""); define("PASSWORD",""); define("DATABASE",""); mysql_connect(HOSTNAME, USERNAME, PASSWORD) or die("Connetion to database failed!"); mysql_select_db(DATABASE); joinDateFilter(); // BILL QUERY function joinDateFilter(){ $query = mysql_query("SELECT bills.billname, bills.duedate, bills.firstname, bills.email, bills.paid FROM bills JOIN users ON bills.userid=users.userid WHERE DATE(bills.duedate) = CURDATE() AND bills.PAID != 'YES'"); $mail_to = ""; while ($row = mysql_fetch_array($query)){ echo $row['firstname']." - ".$row['email']."\n"; $mail_to = $row['email'].", "; } if (!empty($mail_to)){ sendEmail($mail_to); } } // SEND EMAIL function sendEmail($mail_to) { $from = "MyEmail@myemail.com"; $message = "Dear " . $row['firstname'].", <br><br>" ."You have the following bills due today.<br><br>" .$row['billname']. "<br><br>" ."Please login to pay your bills"; $headers = 'From: '.$from."\r\n" . 'Reply-To:'.$_POST['email']."\r\n" . "Content-Type: text/html; charset=iso-8859-1\n". 'X-Mailer: PHP/' . phpversion(); mail($mail_to, "Today is your due date", $message, $headers); } ?>
  8. I figured out what I needed to do thank you for your advice though. I have everything working like I needed.
  9. I did that. I need the other fields updated in my database for other data and filtering that I am doing with the project. Is there anymore alternatives then?
  10. Good evening, I have a jQuery datepicker that I am trying to insert different date values into different textboxes based on the user's selection. The original box displays the standard date format, input box 2 displays the date format suited for mysql, input box 3 needs to display the Month based on user selection, input box 4 displays the Year, and input box 5 needs to display the Month and the Year. The problem I am having is when I try to add multiple altField, it will only update the last id indicated. Here's my code. Thanks in advanced, Demeritrious HTML <input type="text" id="Goal" name="Goal" value="<?php echo $Goal; ?>"> <input type="text" id="GoalDate" name="GoalDate" value="<?php echo $GoalDate; ?>"> <input type="text" id="MyBillsMonth" name="Month" value="<?php echo $Month; ?>"> <input type="text" id="MyBillsYear" name="Year" value="<?php echo $Year; ?>"> <input type="text" id="MyBillsMonthYear" name="MonthYear" value="<?php echo $MonthYear; ?>"> JQUERY I've tried this $( "#Goal" ).datepicker({ changeMonth: true, changeYear: true, dateFormat: 'mm-dd-yy', altField: "#GoalDate, #MyBillsMonth, #MyBillsYear, #MyBillsMonthYear", altFormat: "yy-mm-dd, MM, yy, MM yy" }); AND This $( "#Goal" ).datepicker({ changeMonth: true, changeYear: true, dateFormat: 'mm-dd-yy', altField: "#GoalDate", altFormat: "yy-mm-dd", altField: "#MyBillsMonth", altFormat: "MM", altField: "#MyBillsYear", altFormat: "yy", altField: "#MyBillsMonthYear", altFormat: "MM yy" });
  11. I would appreciate if someone could figure this out or tell me the easiest way to do this. I need a count up counter that appears in a textbox so I can record the time a user is on a page. On a side note, I do have their Start and finish time timestamp recorded in myphpadmin database but I am looking for the easiest (or best) way to do this. Any advice or scripts would be very much appreciated. Thanks in advanced. I did find this counter that works but the numbers appear 0.0.1 if counting up. I don't want to confuse the user. I really want to display to the user how long they was on a certain page. <script> $(document).ready(function() { var time = '00:00:00', parts = time.split(':'), hours = +parts[0], minutes = +parts[1], seconds = +parts[02], input = $('#timeInput'); var timer = setInterval(function(){ seconds++; if(seconds == 60) { seconds = 00; minutes++; if(minutes == 60) { minutes = 00; hours++; } } var newTime = hours + ":" + minutes + ":" + seconds; $('#timeInput').val(newTime); }, 1000); }); </script> <input type="text" name="time" id="timeInput"/>
  12. I would really appreciate help and I hope my problem can be solved easily. I am attempting to display the date/time based on the user's location. I have installed the timezone.js plugin for help as well. Is there a way to convert the Jquery variable that displays the users timezone location and insert it inside the PHP date_default_timezone_set? If there is an easier way to display the users timezone date and time please let me know otherwise this was the only solution I could find. Thanks in advanced... Here is my code Header <header> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script src="Time/detect_timezone.js"></script> <script src="Time/jquery.detect_timezone.js"></script> <script> $(document).ready(function(){ $('#tzvalue').set_timezone({'default' : 'America/Los_Angeles'}); }); </script> </header> Currently I have: (the timezone currently appears in the text box and below the textbox PHP echos the current time in my timezone) <input type="text" Name="Timezone" id="tzvalue"></input> <?php date_default_timezone_set("America/Chicago"); echo "The time is " . date("h:i:sa"); ?> What I want is: <?php date_default_timezone_set("$tzvalue"); echo "The time is " . date("h:i:sa"); ?>
  13. I have no idea how to do either. Is there a script or demo that you know of?
  14. Any help on this would been very much appreciated. I am trying find a way to save the state of the JQuery accordions on my webpage after a user refreshes or changes webpages within my website. I have tried installing different scripts and downloading different cookie plugins but they either don't work or breaks all of the jquery functions on my webpage. Thank you. This is in my header <head> <link rel="stylesheet" type="text/css" href="css/styles.css"> <link rel="stylesheet" type="text/css" href="css/jquery-ui.css"> <script src="js/jquery.js"></script> <script src="js/jquery-ui.js"></script> <script type="text/javascript" src="Cookies/jquery.cookie.js"></script> </head> My Html <div id="History"> <!---Images---> <p>Today In History</p> <div> <script type="text/javascript" src="http://rss.brainyhistory.com/link/historyevents.js"></script><small><i>more <a href="http://www.brainyhistory.com/" target="_blank">History</a></i></small> </div> </div> This is my original JQuery code $( "#History" ).accordion({ collapsible: "true", heightStyle: "content" });
  15. I know this should be easy but I cannot find right query to do this online. I simple want a counter of each result of my query. What is the proper way to query this. For example 1 | Result 1 2 | Result 2 3 | Result 3 The one I found online did a weird grouping counter. 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.