I've been searching for an answer for a while now, but can't seem to find anything.
I'm looking for a way to use mysqli_bind_param
to insert a row into a table, where the param (?)
is part of a larger string.
This is my code:
$query = "INSERT INTO CDBusers_activity (order_ID, activity_text_desc) VALUES (?, 'Price edited from ? to ?')";
$stmt = mysqli_prepare($DB_conn, $query);
mysqli_bind_param($stmt, "sss", $orderID, $product_editPrice_was, $product_editPrice_now);
mysqli_stmt_execute($stmt);
I'm looking for a way to add the $product_editPrice_was
and $product_editPrice_now
into the row.
I could create a string:
$text = "Price edited from $product_editPrice_was to $product_editPrice_now"
and then bind that, but I am interested if there is a simpler way? For example:
$query = "INSERT INTO CDBusers_activity (order_ID, activity_text_desc) VALUES (?, 'Price edited from ' ? ' to ' ?)";