Jump to content

[SOLVED] MySQL table wont update


cleary1981

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.