Using the PHP PDO library, I'm trying to use a prepared statement, but it's not working. I have this sql:
$update_sql = "UPDATE test_table SET zero_or_one_photo = 1 WHERE mls_id = :mls_id AND mls_no in ( :mls_no_list )";
$update_stmt = $dbh->prepare($update_sql);
I bind the values:
$update_stmt->bindValue( ':mls_id', 'MD-BRIGHT' );
$update_stmt->bindValue( ':mls_no_list', '1234567' );
(eventually, I will have many values for the mls_no, but I'm just testing now)
$rows = $update_stmt->execute();
print "Execute returns: $rows rows\n";
this writes out "Execute returns 1 rows", but the database value is not actually changed. If I change things slightly:
$update_sql = "UPDATE test_table SET zero_or_one_photo = 1 WHERE mls_id = :mls_id AND mls_no in ( '1234567' )";
$update_stmt = $dbh->prepare($update_sql);
I bind just the one value:
$update_stmt->bindValue( ':mls_id', 'MD-BRIGHT' );
$rows = $update_stmt->execute();
print "Execute returns: $rows rows\n";
Also writes out that 1 row was changed, but this time, the database row actually did change. Is this just the way it is - you can't bind into an "IN ()" clause?