I am trying to do something similar to this…
$sql = "SELECT * FROM foo WHERE user = ? AND order LIKE ?%"
$stmt = db2_prepare($conn, $sql);
db2_bind_param($stmt, 1, "userName", DB2_PARAM_IN);
db2_bind_param($stmt, 2, "orderNum", DB2_PARAM_IN);
db2_execute($stmt);
Of course, its not the right way to do LIKE ?%. I’m just looking for the correct way to bind a parameter like that but also use the % wildcard.
Just stick the parameter with the wildcard characters in the string. You’ll want to do something like (see example #12):
and