0

hello, I am having issues inserting comma separated values to my database, this is what I have:

$invoiceProducts = "14:12,"; // eventualy the 14:12, will multiply to other values 43:2,34:1,45:1, etc
$invoiceProducts = addslashes($invoiceProducts); //stripslashes() to remove the slashes tried with and without stripslashes. 

$stmt = $conn->prepare("INSERT INTO invoices (invoiceActive, invoiceProducts) VALUES (?, ?)");
$stmt->bind_param("is", 1, $invoiceProducts);
$stmt->execute();

Error:
Fatal error: Cannot pass parameter 2 by reference

is this the best way to create this row of data? is there a better way?

why wont this work?
thanks :)

Edited by Dani: Formatting fixed

3
Contributors
3
Replies
29
Views
2 Years
Discussion Span
Last Post by elamigosam
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.