digital-ether
Nearly a Posting Virtuoso
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101
Try turning on error reporting.
error_reporting(E_ALL);
ini_set('display_errors', '1');
And also doing some error handling:
$result = mysql_query($updateQuery)
if (!$result) {
die('Mysql Error" '.mysql_error());
}
It will let you know what is wrong.
digital-ether
Nearly a Posting Virtuoso
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101
Try doing some error checking:
$result = mysql_query("...");
if (!$result) {
die("MySQL Query failed with error: " . mysql_error());
}
That will tell you what went wrong with the query.
Note: You should never use values taken from POST and GET directly in your sql query. Such as $_POST['SRID']. You need to escape them first so they do not "break" the mysql query.
eg:
$srid = mysql_real_escape_string($_POST['SRID']);
...
$result = mysql_query("UPDATE testtable SET SRID = '$srid' .... ");
Imagine a user used a value:
$_POST['SRID'] = "this value has a single quote in it ' so it will break the query";
If you put that directly into the mysql query, then the query would look like:
"UPDATE testtable SET SRID = 'this value has a single quote in it ' so it will break the query' .... "
Notice how you now have three quotes, when there should only be two surrounding a value. This can be exploited intentionally or unintentionally by users to break to the query, or run other queries you did not expect.
When you use mysql_real_escape_string() on the value, it makes sure any quotes are escaped, so that they do not break the string.
digital-ether
Nearly a Posting Virtuoso
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101
That was only an example. You have to put your actual mysql query into mysql_query(), and not the "..." that I put there.
digital-ether
Nearly a Posting Virtuoso
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101
$result = mysql_query("UPDATE testtable SET fname = '$fname', sname = '$sname', `add` = '$add', phone ='$phone' Call_Status = '$Call_Status', eng_id = '$eng_id', eng_cmt = '$eng_cmt' WHERE SRID = '$SRID'");if (!$result) { die("MySQL Query failed with error: " . mysql_error()); }
I think u missing comma in your query.
$result = mysql_query("UPDATE testtable SET fname = '$fname', sname = '$sname', `add` = '$add', phone ='$phone'<strong>,</strong> Call_Status = '$Call_Status', eng_id = '$eng_id', eng_cmt = '$eng_cmt' WHERE SRID = '$SRID'");if (!$result) { die("MySQL Query failed with error: " . mysql_error());}
See red comma in above query.
I hope now your problem will be solved. :)
pbcomput
Junior Poster in Training
59 posts since Feb 2010
Reputation Points: 19
Solved Threads: 4