I have no idea why this query doesnt work? the WHERE part will work if I put the value in of the rowset, but I can echo out the variable $faultid and its the same? it executes the query but doesnt change the record? all the variables are declared before this statement?

thanks

$result = "UPDATE  faults SET dslam='$dslam', hsl='$hsl',psba='$psba',hostname='$hostname',sitename='$sitename',postcode='$postcode',bandwidth='$bandwidth',live='$live', remedy='$remedy',changeofservice='$changeofservice',
serviceaffecting='$serviceaffecting',comments='$comments',tiepair='$tiepair',circuit='$circuit',faulttype='$faulttype',bttest='$bttest',btref='$btref',assigned='$assigned' WHERE faultid= '$faultid'";
mysql_query($result);

Recommended Answers

All 6 Replies

Do this and find out:

$response = mysql_query($result) or die(mysql_error() . '<br/>' . $result);

Are you sure none of the variables contains a single quote, messing up your query?

nothing gets returned with the above code, there are no errors in the variables, as if I change the where clause to the actual value, i.e 1, it corrects ammends the record where the id is 1.. it just doesnt like the variable in the where clause..

before running query echo its output and run in phpmyadmin or observe prepared query statment

echo $result;

mysql_query($result);

why not enclose the variables in curly braze i.e WHERE faultid={'$faultid'}";

Dude, thank you, just needed another brain on it! the $faultid wasnt being posted to the page, so it had no idea what it was, I wrapped without quotes when posting it to the page.. works now. thank you for your time :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.