Hi .. I can't get this UPDATE working, i can successfully INSERT INTO and SELECT*FROM the mysql table, but this UPDATE script does not update. I have copy/pasted any section i can from working queries. I have followed and implemented all forum solutions with no joy, I run the script in the browser and get no errors ... This is my first attempt at PHP web services so my knowledge is limited and so hopefully the problem will be painfully obvious to the trained eye.
If anyone can see anything or suggest something to establish the problem it would be greatly appreciated
@mysql_select_db('*************') or die ('Unable to find database');
$formTitle = $_POST['formTitle'];
$formRows = $_POST['formRows'];
$status = $_POST['status'];
$openedBy = $_POST['openedBy'];
$openedDate = $_POST['openedDate'];
$modifiedBy = $_POST['modifiedBy'];
$modifiedDate = $_POST['modifiedDate'];
$closedBy = $_POST['closedBy'];
$closedDate = $_POST['closedDate'];
$sendTo = $_POST['sendTo'];
$formCount = $_POST['formCount'];
$query = "UPDATE forms SET formRows='$formRows',status='$status',openedBy='$openedBy',openedDate='$openedDate',modifiedBy='$modifiedBy',modifiedDate='$modifiedDate',closedBy='$closedBy',closedDate='$closedDate',sendTo='$sendTo',formCount='$formCount' WHERE formTitle ='$formTitle'";
mysql_query($query) or die (mysql_error());
I'd suggest you start with the essentials: Add echo($query) to the script so you can see exactly what's being sent to the mysql_query() function. Then use a tool like phpMyAdmin to examine the data before and after your tests. At a guess, I'd bet that there's a problem with the $formTitle variable that prevents the query from finding a matching record in the database to update. The code runs without an error because there are no syntax errors in the script or the query, but nothing happens.
Thank you for your suggestions, i went back to using the formID rather than the formTitle .... for anyone else in the same predicament ...this is what ended up working in the end... so might be worth trying.
mysql_query("UPDATE forms SET formRows='".$formRows."',status='".$status."',openedBy='".$openedBy."',openedDate='".$openedDate."',modifiedBy='".$modifiedBy."',modifiedDate='".$modifiedDate."',closedBy='".$closedBy."',closedDate='".$closedDate."',sendTo='".$sendTo."',formCount='".$formCount."' WHERE formID ='".$id."'");