Jump to content

jcjst21

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jcjst21's Achievements

Member

Member (2/5)

0

Reputation

  1. I tried what you suggested and it changed everything to a 1... then I switched up the numbers to set it equal to something else and nothing was updated... here's my current code... //fix data $select=mysql_query("SELECT campGroupAssignments.camperID, campGroupAssignments.campGroupID, CamperMedicationInfo.camperGroupID FROM campGroupAssignments LEFT JOIN CamperMedicationInfo ON campGroupAssignments.camperID=CamperMedicationInfo.camperID WHERE campGroupID=2"); while($result=mysql_fetch_array($select)) { $update=mysql_query("UPDATE CamperMedicationInfo SET camperGroupID=2 WHERE campGroupID=2"); }
  2. Hi: My Update query below; is not updating either at ALL or it updates all records to the same number... Could someone please take a look and give me any suggestions? Thanks $select=mysql_query("SELECT campGroupAssignments.camperID, campGroupAssignments.campGroupID, CamperMedicationInfo.camperGroupID FROM campGroupAssignments LEFT JOIN CamperMedicationInfo ON campGroupAssignments.camperID=CamperMedicationInfo.camperID WHERE campGroupID=3"); while($result=mysql_fetch_array($select)) { $camper=$result['camperID']; $assignments=$result['campGroupID']; $needsSet=$result['camperGroupID']; echo $camper. " " .$assignments. " " .$needsSet. "</br>"; $update=mysql_query("UPDATE CamperMedicationInfo SET $needsSet=2 WHERE $assignments=2"); }
  3. Ok then... what do I use for my value to load for a form if it already pulls the id?? the "cMedID" from the response function?
  4. Thanks for looking at this... Here is the code for my main page: $("#addADose").click(function() { var cMedName=$("#cMedName").val(); var doseAmount=$("#doseAmount").val(); var doseMeasurement=$("#doseMeasurement").val(); var quantity=$("#quantity").val(); var doseMeasurement2=$("#doseMeasurement2").val(); var Sunday = $('#Sunday').attr('checked')?1:0; var Monday = $('#Monday').attr('checked')?1:0; var Tuesday = $('#Tuesday').attr('checked')?1:0; var Wednesday = $('#Wednesday').attr('checked')?1:0; var Thursday = $('#Thursday').attr('checked')?1:0; var Friday = $('#Friday').attr('checked')?1:0; var Saturday = $('#Saturday').attr('checked')?1:0; var doseCount=$("#doseCount").val(); $.post( 'medicationInfoPost.php', { cMedName:cMedName, doseAmount:doseAmount, doseMeasurement:doseMeasurement, quantity:quantity, doseMeasurement2:doseMeasurement2, Sunday:Sunday, Monday:Monday, Tuesday:Tuesday, Wednesday:Wednesday, Thursday:Thursday, Friday:Friday, Saturday:Saturday, doseCount:doseCount }, function(response) { $("#displayMedicationInfo").load("medicationInfoPull.php"); $("#medicationNameID").val(""); $("#doseAmount").val(""); $("#medMeasureNameID").val(""); $("#quantity").val(""); $("#medMeasureNameID").val(""); $("#doseCount").val(""); $("#cMedID").val(""); $("#medID").load("getLastIDCreated.php"); $("#lastID").val($theMaxID); } Then here is the code for the page that does the mySQL insert $sql="INSERT INTO CamperMedicationInfo(userID, etc....) VALUES ('$userID', '$camperID', etc....')"; mysql_query($sql); $cMedNumber=mysql_insert_id(); Then the code that pulls the data $sql2=mysql_query("SELECT * FROM CamperMedicationInfo WHERE camperID=$camperID ORDER BY cMedID"); $maxid=mysql_query("SELECT MAX(cMedID) FROM CamperMedicationInfo WHERE camperID=$camperID"); $maxIDretrieve=mysql_fetch_array($maxid); $theMaxID=$maxIDretrieve[0];
  5. ok it's working now, BUT it's return the previously created ID... so when the id should be for instance "3", it's return "2"... i called it this way in the response function function(response) { $("#lastID").val($theMaxID); }
  6. Well I did a "POST" function on the main page to send the form data; but I want to GET the id created back... OK so use JSON...so on the main page...how would I call it...in the same response function for the button "on click" function that contains the POST function?
  7. I created a function using jquery to load data from another file to display on my main page. The user will fill out some information on the main page, and I post it to another file and perform the mysql INSERT. I would like to pass the last created id in that table back to the main page to insert it as the default value in another form on the main page... how would I do that with the jquery functions? I thought of the get function, but that didn't work:( Thanks, jcj
  8. If i did it this way where it only prints if the group id changes then how can i make a header for the group name?
  9. I'll try group concat but also, how could i indicate when the groupID changes in the while loop?
  10. I have been searching the forums to find how to group a table by ID and list each record associated with it. All I have been finding is how to group by and using it to do a sum or average or count. What I want to do is, Group By ID, and list each associated row... Example: Group A: -Person A -Person B Group B -Person C -Person D I tried multiple variations of a while loop without success... any advice?
  11. I have created a popup form to view customer data...I need to send an email from this popup page. I created a form to post data to the same popup page and when i click the submit button; it reverts completely back to the websites main index page... The form is set to "post" to another php page in my directory... I don't know why; can anyone help?
  12. Hello, I have a while loop that prints the contents of a field in one of the tables in my database. I would like the user to have the option to delete that record from the website. I created a button that is displayed with an icon image, but would like to call a php function onclick. Here is my code for the while loop generating a row in the table for each record: <table> <?php while($row = mysql_fetch_array($result)) { echo "<tr><td>" .$row['Name']. "</td><td><input type=\"image\" src=\"1340120170_edit.ico\"></td><td><input type=\"image\" src=\"1340120267_delete.ico\" onclick=\"deleteRecord(" .$row['nameID']. ")\"></td></tr>"; } mysql_close($con); ?> </table> I'm calling "deleteRecord()" from the last button..I want to pass in $row['nameID'] into the function deleteRecord().... am I setting up my echo or input statement incorrectly? Here is my deleteRecord() function: function deleteRecord(&$recordNum) { $nameID=$recordNum; $sql3=mysql_query("DELETE FROM utilityNames WHERE nameID=$nameID"); } When I click the button; nothing happens? Any advise? Thanks:) in advance.
  13. Hello, I have three scripts below that I was wondering if someone can look at as a second opinion. What they all have in common is they are supposed to append data to some tables in my database. They match the code on all my other scripts but for some reason these particular scripts will not append the data to the files. This first one... is supposed to insert the name of the doctor this person uses, and then gets the last ID created and inserts it into another table...no matter what I try, it will not do it. <?php session_start(); $userid=$_SESSION['userID']; $firstName=$_SESSION['fname']; $lastName=$_SESSION['lname']; $camperID=$_POST['camperID']; $physicianFName=$_POST['physicianFName']; $physicianLName=$_POST['physicianLName']; $physicianSuffix=$_POST['physicianSuffix']; $practiceName=$_POST['practiceName']; $physicianAddress1=$_POST['physicianAddress1']; $physicianAddress2=$_POST['physicianAddress2']; $physicianAddress3=$_POST['physicianAddress3']; $physicianCity=$_POST['physicianCity']; $physicianState=$_POST['physicianState']; $physicianZip=$_POST['physicianZip']; $physicianOfficeP=$_POST['physicianOfficeP']; $physicianOfficeF=$_POST['physicianOfficeF']; $physicianSpecialty=$_POST['physicianSpecialty']; echo $camperID. ' ' .$physicianFName. ' ' .$physicianLName; //htc information and physician $htcName=$_POST['htcInfo']; $htcPhysician=$_POST['htcPhysician']; $con=mysql_connect("xxx.xxx.xxx.xx", "xxx", "xxxx") or die ("cannot connect"); mysql_select_db("testcamp") or die ("cannot select database"); $sql="INSERT INTO Physicians(physicianFName, physicianLName, physicianSuffix, practiceName, physicianAddress1, physicianAddress2, physicianAddress3, physicianCity, physicianState, physicianZip, physicianOfficeP, physicianOfficeF, physicianSpecialty) VALUES ('$physicianFName', '$physicianLName', '$physicianSuffix', '$physicianAddress1', '$physicianAddress2', '$physicianAddress3', '$physicianCity', '$physicianState', '$physicianZip', '$physicianOfficeP', '$physicianOfficeF', '$physicianSpecialty')"; $result=mysql_query($sql,$con); $physicianID=mysql_insert_id(); $sql2="INSERT INTO CamperPhysicianInfo(physicianID, camperID) VALUES ('$physicianID', '$camperID')"; $result2=mysql_query($sql2,$con); $sql3="INSERT INTO CamperHTCInfo(camperID, htcID) VALUES ('$camperID', '$htcName')"; $result3=mysql_query($sql3,$con); $sql4="INSERT INTO camperHTCPhysicianInfo(camperID, htcPhysicianID) VALUES ('$camperID', '$htcPhysician')"; $result4=mysql_query($sql4,$con); ?> This next one...is supposed to enter data into the CamperRegistrations tables and also enter data into another table for a questionaire that was completed on the form previous to this page...same thing no matter what I try will not append data. <?php $question12=$_POST['question12']; $question12a=$_POST['question12a']; session_start(); $userid=$_SESSION['userID']; $firstName=$_SESSION['fname']; $lastName=$_SESSION['lname']; $camperID=$_SESSION['camperID']; $con=mysql_connect("xxx.xxx.xxx.xx", "xxx", "xxx") or die ("cannot connect"); mysql_select_db("testcamp") or die ("cannot select database"); $sql="INSERT INTO Question12(camperID, question12Answer, teaching) VALUES ('$camperID', '$question12', '$question12a')"; $result=mysql_query($sql,$con); $date=date("Y-m-d"); $defaultStatus=1; $sql2="INSERT INTO CamperRegistrations(userID, camperID, registrationDate, registrationStatus) VALUES ('$userid', '$camperID', '$date', '$defaultStatus')"; $result2=mysql_query($sql2,$con); ?> and then on this same page with this script... is it possible to carry session information when using HTML links instead of a submit form? I need the userid to carry to the next page with a link, but it won't do that either... Any help would be appreciated and thanks in advance for looking. ~jcjst21
  14. Thank you very much. This worked out very nicely. It is exactly what i was looking for.
  15. Thank you so much! So if I have an ajax request that continuously polls the server for price updates, like if another user bids on an item, and i want the price to automatically change... what parameter would i pass into that function? To refresh the page every 30 seconds or so?
×
×
  • 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.