How would I best setup a query statement so that I can insert an autoincremented value that would be concatenated with a hypen.
For example the end result would be 0-01, 0-02, 0-03, .... this would help me when the value reaches 0-99 the next row will be 1-00. Hopefully that makes sense.
Thanks for any input.
Here was my Thought.
$stmt = $connection->prepare("INSERT INTO merchandise (mfr,type,description,mer_sku,price,qty) VALUES (?,?,?,?,?,?)");
$stmt->bind_param("ssssssss", $mfr,$type,$desc, "MR".$mfr.$sku."-".$sku,$price,$qty);
EDITED SUGGESTED CODE
This is my current setup but it will not submit.
<?php
if (isset($_POST['submit'])) {
$mfr = $_POST['mfr'];
$type = $_POST['type'];
$desc = $_POST['description'];
$price = $_POST['price'];
$qty = $_POST['qty'];
$connection->query("SELECT m_id FROM merchandise");
$result = $connection->fetch_assoc();
$last_id = $result["m_id"];
$next_id = $last_id + 1;
$conc = number_format($next_id/100,2,'-','');
$connection->query("INSERT INTO merchandise (mfr,type,description,mer_sku,price,qty) VALUES ('$mfr','$type','$desc','MR'.'$mfr'.'$conc','$price','$qty')");
}
?>