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 :)

Recommended Answers

All 3 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.