Hey Merve,
thanks for your quick reply. Tried that both. (putting space after the comma and putting arguments in reverse order)
Same problem still.
What's funny is that I use this code in my script twice. I only get an error in one of them.
Below is the complete script, the first implode generates the error while the second implode gets executed without any problem:
The values that are posted to the second look like t1=text1;t2=text2... and so on
<?php
include ('connectdb.php');
$index = 0;
foreach ($_POST as $key => $value) {
if (substr($key, 0, 1) == "p") {
$prijzen[$index] = $value;
$index++;
}
$prijzendb = implode('`', $prijzen);
}
// submit string to database
$query = "UPDATE riet_prijzen SET prijzen=\"$prijzendb\" WHERE id=1";
$result = mysql_query($query);
if (!$result){
die ("Error performing query in riet_prijzen q1 | ". mysql_error() );}
$index = 0;
foreach ($_POST as $key => $value) {
if (substr($key, 0, 1) == "t") {
$text[$index] = $value;
$index++;
}
$textdb = implode('`', $text);
}
// submit string to database
$query = "UPDATE riet_prijzen SET text=\"$textdb\" WHERE ID=1";
$result = mysql_query($query);
if (!$result){
die ("Error performing query in riet_prijzen q2 | ". mysql_error() );}
?>