I am using the below-prepared statement to insert into MySQL. If I try and insert something with $descrip
containing a " (double quote) the insert stops at this point.
Example:
Trying to insert 16" Solid Steel Tube
The entry into the table row only shows 16
and stops at the " (double quote) and wont show the rest of $descrip
.
What am I doing wrong?
$stmt = $db->prepare("INSERT INTO line_items (quote_id, part, descrip, qty, price, net, notes, datasheet) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("ssssssss", $quote_id, $part, $descrip, $qty, $price, $net, $notes, $datasheet);
foreach($_POST['part'] as $i => $item) {
$part = $item;
$descrip = $_POST['descrip'][$i]; //This wont enter something with double qutoes such as 16" Solid Steel Tube
$qty = $_POST['qty'][$i];
$price = $_POST['price'][$i];
$net = $_POST['net'][$i];
$notes = $_POST['notes'][$i];
$datasheet = $_POST['datasheet'][$i];
$stmt->execute();
}
EDIT:
FYI- I am selecting $descrip
from another table in the database which correctly has this in the row as 16" Solid Steel Tube
. When I try and copy this item into another table via my prepared statement that is when it wont insert properly.