Jump to content

demeritrious

Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by demeritrious

  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
  16. The like/dislike button script found here: http://wcetdesigns.com/tutorials/demos/like-dislike-button.html works perfectly for what I am trying to do on my webpage. The issue I am having is I can connect to one table perfect but the script breaks if I try to add another set of like/dislike buttons that connects to another table. How can I add 2 additional like/dislike button sets that can connect to 2 addtional tables in my database. For example Topic name (like/dislike button set that connects to table 1) Messages (like/dislike button set that connect to table 2) Message Replies (like/dislike button set that connects to table 3) any help would be appreciated. Thanks
  17. This is my query so far...it works to display all topics with message count but I want to add the messagereply count to the message count as well. SELECT Topics.TopicName, COUNT(message.MsgID), DATE_FORMAT(TopicActiveDate, '%M-%d-%Y') AS ActiveDate FROM topics Left Join message ON topics.TopicName=message.TopicName GROUP BY TopicName Order By Topics.TopicActiveDate DESC
  18. I hope this is the right section of the forum for sql query help. I have three different tables in my phpmyadmin database for my website (Topics, Message, MessageReply). Users will have the ability to post messages within a topic and also respond to messages posted within each topic. I am now stuck trying to write a query that will display all of the topics created in one column and all Messages + Message Replies to those topics in a 2nd column. Please help. thanks,
  19. Thank you very much! Without meaning to sound greedy is there a way that the user can press enter to select the autocomplete as if they selected it with their mouse. I was wondering why you included json I've never used it before. It seems to work without the JSON and loads a little slower if I include "//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js". I don't know why. Also, I still cannot figure out why theres a null value if I select the text of the result but words just find if I select the area around the text. Any idea? Here is the code that worked for me: Jquery <script type="text/javascript"> $(function(){ $(".search").keyup(function(e) { // don't want keyup to fire if we are scrolling if(e.which == 38 || e.which == 40) { return false; } var searchid = $(this).val(); var dataString = 'search='+ searchid; if(searchid!='') { $.ajax({ type: "POST", url: "search.php", datatype: "json", data: dataString, cache: false, success: function(html) { $("#result").html(html).show(); } }); }return false; }).keydown(function(e) { // check if result div is visible var visible = $('#result').is(':visible'); var key = e.which; // down arrow if(key == 40) { if(visible) { if($('#result div.selected-hint').length == 0) { var child = $('#result div:nth-child(1)'); child.addClass('selected-hint'); } else { if($('#result div.selected-hint').next('div').length) { $('#result div.selected-hint').removeClass('selected-hint').next('div').addClass('selected-hint'); } else { $('#result div.selected-hint').removeClass('selected-hint'); } } } } // up arrow if(key == 38) { if(visible) { if($('#result div.selected-hint').prev('div').length) { $('#result div.selected-hint').removeClass('selected-hint').prev('div').addClass('selected-hint'); } else { $('#result div.selected-hint').removeClass('selected-hint'); } } } }); jQuery("#result").live("click",function(e){ var $clicked = $(e.target); var $name = $clicked.find('.name').html(); var decoded = $("<div/>").html($name).text(); $('#searchid').val(decoded); var yourLinkHref= $(this).attr('href'); window.location = "mainpage.php?TopicName=" + $name; }); jQuery(document).live("click", function(e) { var $clicked = $(e.target); if (! $clicked.hasClass("search")){ jQuery("#result").fadeOut(); } }); }); </script> CSS <style type="text/css"> body{ font-family:Tahoma, Geneva, sans-serif; font-size:18px; } .content{ width:auto; margin:0 auto; } #searchid { width:200px; font-size:14px; } #result { position:absolute; width:200px; display:none; margin-top:-1px; border-top:0px; border:1px #CCC solid; background-color: white; z-index:1; } .show { border-bottom:1px #999 dashed; font-size:14px; padding:4px; width:auto; } .show:hover { background:#4c66a4; color:#FFF; cursor:pointer; } .selected-hint { background-color:#E2E1E1; } </style>
  20. Thank you for responding. I've notice the autocomplete works if you click in the space around the text, but if you click the text it would generate a null value. very strange A part of my html that is related to this <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <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="js/jquery-ui.min.js"></script> </head> <div id="pagewrap"> <!---Header---> <div id="header"> <div align="right">Welcome <?php echo $_SESSION['MM_Username']; ?> </div> <img src="images/HomeBackgound.jpg" alt="" width="100%" height="50" /> <!--Autocomplete--> <div class="content"> <input type="text" class="search" id="searchid" placeholder="Search For Topics" /> <div id="result"> </div> </div> And the CSS for the autocomplete <style type="text/css"> body{ font-family:Tahoma, Geneva, sans-serif; font-size:18px; } .content{ width:auto; margin:0 auto; } #searchid { width:200px; font-size:14px; } #result { position:absolute; width:200px; display:none; margin-top:-1px; border-top:0px; border:1px #CCC solid; background-color: white; z-index:1; } .show { border-bottom:1px #999 dashed; font-size:14px; padding:4px; width:auto; } .show:hover { background:#4c66a4; color:#FFF; cursor:pointer; } </style>
  21. I have a working autocomplete which connects to my database using ajax. I am trying to include a function where the user can scroll through the results list using the up/down arrow keys. All of the suggestions I found in google basically broke my autocomplete and yes I've installed the latest Jquery. Also, for some reason the user has to click the upper half of the search result in order for the data to display otherwise it won't register for some reason any ideas about that? Any help would be greatly appreciated. Thanks <script type="text/javascript"> $(function(){ $(".search").keyup(function() { var searchid = $(this).val(); var dataString = 'search='+ searchid; if(searchid!='') { $.ajax({ type: "POST", url: "search.php", data: dataString, cache: false, success: function(html) { $("#result").html(html).show(); } }); }return false; }); jQuery("#result").live("click",function(e){ var $clicked = $(e.target); var $name = $clicked.find('.name').html(); var decoded = $("<div/>").html($name).text(); $('#searchid').val(decoded); var yourLinkHref= $(this).attr('href'); window.location = "mainpage.php?TopicName=" + $name; }); jQuery(document).live("click", function(e) { var $clicked = $(e.target); if (! $clicked.hasClass("search")){ jQuery("#result").fadeOut(); } }); $('#searchid').click(function(){ jQuery("#result").fadeIn(); }); }); </script>
  22. AHHHHH I didn't even notice!!!...Thank you very much for your help! It works the way it is but is there a way to make sure it is in the Y-m-d format in case someone types in random data? This is what worked for me. /* Birthday error checking */ $field = "Birthday"; //Use field name for Birthday if(!$subBirthday || strlen($subBirthday = trim($subBirthday)) == 0){ $form->setError($field, " * Please enter birthday"); } else if( $subBirthday > date("Y-m-d", strtotime("-18 years"))){ $form->setError($field, "* You are too young!"); }
  23. By the way this worked for me for Invalid Email validation..maybe this might help someone: /* Email error checking */ $field = "email"; //Use field name for email if(!$subemail || strlen($subemail = trim($subemail)) == 0){ $form->setError($field, "* Please enter email address!"); } else{ /* Check if valid email address */ $regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*" ."@[a-z0-9-]+(\.[a-z0-9-]{1,})*" ."\.([a-z]{2,}){1}$"; if(!eregi($regex,$subemail)){ $form->setError($field, "* Email invalid"); } $subemail = stripslashes($subemail); }
  24. I could not figure out how to manipulate it to give me an error confirmation that says the data entered is not in the correct format or if the user is under 18
  25. I'm receiving this error: Fatal error: Call to undefined function strototime()
×
×
  • 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.