cleary1981 Posted July 22, 2008 Share Posted July 22, 2008 Hi I have passed variables to php in the javascript below function updateProjectDetails() { var ud_proj_id = document.company1.proj_id_edit.value; var ud_access = document.company1.access_edit.value; var ud_cable = document.company1.cable_edit.value; var ud_ip = document.company1.ip_edit.value; var ud_fault = document.company1.fault_edit.value; var ud_form = document.company1.form_edit.value; var ud_pman = document.company1.pman_edit.value; var ud_dl = document.company1.deadline_edit.value; var url = "updateProjectDetails.php"; request.open("POST", url, true); request.onreadystatechange = showConfirmation; request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); request.send("ud_proj_id" + escape(ud_proj_id) + "ud_access=" + escape(ud_access) + "ud_cable=" + escape(ud_cable) + "ud_ip=" + escape(ud_ip) + "ud_fault=" + escape(ud_fault) + "ud_form=" + escape(ud_form) + "ud_pman=" + escape(ud_pman) + "ud_dl=" + escape(ud_dl)); } heres my php with a few different options i have tried commented out. None of them will update the db. Can anyone see where im going wrong? <?php require "config.php"; $ud_proj_id = $_REQUEST['ud_proj_id']; $ud_access = $_REQUEST['ud_access']; $ud_cable = $_REQUEST['ud_cable']; /$ud_ip = $_REQUEST['ud_ip']; $ud_fault = $_REQUEST['ud_fault']; $ud_form = $_REQUEST['ud_form']; $ud_pman = $_REQUEST['ud_pman']; $ud_dl = $_REQUEST['ud_dl']; // find project with the relevant project id // insert new values into that project // $query = mysql_query("UPDATE project SET form = '$ud_form', access = '$ud_access', cable_entry = '$ud_cable', ip_rating = '$ud_ip', fault_rating = '$ud_fault', proj_manager = '$ud_pman', deadline = '$ud_dl' [WHERE proj_id = '$ud_proj_id']"); //$query="UPDATE project SET fault_rating = 1000 WHERE proj_id = '.$ud_proj_id.'"; //mysql_query("update project set fault_rating='$ud_fault' where proj_id='$ud_proj_id'"); $sqlUpdate = "UPDATE project SET (form = '$ud_form', access = '$ud_access', cable_entry = '$ud_cable', ip_rating = '$ud_ip', fault_rating = '$ud_fault', proj_manager = '$ud_pman', deadline = '$ud_dl') WHERE proj_id =" . $_REQUEST['ud_proj_id']; echo "Record successfully updated!"; ?> Link to comment https://forums.phpfreaks.com/topic/116027-solved-mysql-table-wont-update/ Share on other sites More sharing options...
revraz Posted July 22, 2008 Share Posted July 22, 2008 Use mysql_error() after your query and see where it's failing. Echo your query to see if the data you assume is there is really there. Link to comment https://forums.phpfreaks.com/topic/116027-solved-mysql-table-wont-update/#findComment-596573 Share on other sites More sharing options...
jonsjava Posted July 22, 2008 Share Posted July 22, 2008 try running the query. mysql_query($sqlUpdate) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/116027-solved-mysql-table-wont-update/#findComment-596575 Share on other sites More sharing options...
cleary1981 Posted July 22, 2008 Author Share Posted July 22, 2008 I changed the php so it didnt take inputs from my javascript and it worked fine. The bug is somewhere else. Thanks anyhow Link to comment https://forums.phpfreaks.com/topic/116027-solved-mysql-table-wont-update/#findComment-596585 Share on other sites More sharing options...
revraz Posted July 22, 2008 Share Posted July 22, 2008 Well as Jon pointed out, you never run the query. Link to comment https://forums.phpfreaks.com/topic/116027-solved-mysql-table-wont-update/#findComment-596587 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.