0

So I am trying to edit my DB, which has HTML stored in it. I am trying to replace the max-width:auto; css styling with a max-width:100%;.
I figured the best way would be to use db2_bind_param in order to avoid sql errors, and safely enter my data into the DB.
However, the db2_bind_param does not seem to be doing anything and I am not sure why?
Here is my code below:

foreach($as400response as $as){
            //string to replace, and declared variables
            $newPARV = str_replace('width: auto;', '100%', htmlentities($as['PARV']));
            $newSKU = $as[SKU];
            $newSPRC = $as[SPRC];
            $newFLDDEF = $as[FLDDEF];
            //mysql query format
            $fix = "update swind.pimpd set parv=? where sku=? and sprc=? and flddef=?";
            //prepare connection
            $stmt =  db2_prepare($conn, $fix);
            // bind parameters
            db2_bind_param($stmt, 1, 'newPARV', DB2_PARAM_IN);
            db2_bind_param($stmt, 2, 'newSKU', DB2_PARAM_IN);
            db2_bind_param($stmt, 3, 'newSPRC', DB2_PARAM_IN);
            db2_bind_param($stmt, 4, 'newFLDDEF', DB2_PARAM_IN);
            //execute query
            db2_execute($stmt, array());
            // display error messages 
            print_r(db2_stmt_errormsg());
        }

I am not getting an error message, but there is also no change in the DB's values.
If anyone could help me out with why this isn't working I'd greatly appreciate it :)

BoogaBooga
  • 147
  • 10
  • 1
    if no error is returned and nothing is updated then probably not row to update was found, then SQLSTATE must be 02000, it's not an error, just a warning, maybe `db2_stmt_error()` will return it – nfgl Apr 13 '22 at 09:32
  • my man, thanks for commenting. So you cannot see any obvious errors with the way the code is written? – BoogaBooga Apr 13 '22 at 09:41
  • Where do you commit your transaction? – mustaccio Apr 13 '22 at 12:40
  • hey @mustaccio, I am not sure what you mean. I am not actively writing any code that does that. – BoogaBooga Apr 13 '22 at 12:49

0 Answers0