chop Posted June 9, 2015 Share Posted June 9, 2015 Here's the code $title="MYTITLE"; $image_id=5; // Make the update database query: $q = "UPDATE ".DBTABLE." SET image_title='$title', available='$available', height='$height', width = '$width', framed ='$framed', matted='$matted', media= '$media', price= '$price', comment = '$comment', hold = '$hold', sold = '$sold', print_available = '$printAvailable', date_created = '$date_created', additional = '$additional' WHERE image_id=$image_id LIMIT 1"; $r = @mysqli_query ($dbc, $q); if (mysqli_affected_rows($dbc) == 1){ echo "The number of rows affectd is 1"; } else {echo "There were no rows affected"; } The result is always that there are no rows affected I am positive about the following: 1. the db table column names are all correct 2. there is an image_id in the table whose value is 5 3. the table name DBTABLE is correct Therefore the image_title should be updated. But it doesn't Furthermore, I get not error messages. Just that no rows were affected. caveat: I've been away from mysql for a while so this could be a really dumb thing. Link to comment Share on other sites More sharing options...
Larry Posted June 9, 2015 Share Posted June 9, 2015 Remove the error suppression operator--@--from in front of mysqli_query(). If that doesn't show you the issue, print out the query being run and run it directly using another interface. Link to comment Share on other sites More sharing options...
chop Posted June 9, 2015 Author Share Posted June 9, 2015 Thank you for the quick response. I will try what you suggest. Link to comment Share on other sites More sharing options...
Necuima Posted June 10, 2015 Share Posted June 10, 2015 If there are no changes to any of the data in the database record, you will get zero affected rows, I'm pretty sure. Cheers. Link to comment Share on other sites More sharing options...
Recommended Posts