please, help me to solve the problem I want to get result like this -->
UPDATE anggota SET id = '1000',name = 'Danti',Address = 'Jalan Mawar' WHERE Kode_anggota='10000'
I use $_GET
for my table name so I can use a query for all of table, this is my code :
<?php
function updateData($value) {
$table = $_GET['tujuan'];
$id = $_GET['id'];
$query1 = mysql_query("SELECT * FROM $table ORDER BY Kode_$table");
$fieldNum = mysql_num_fields($query1);
for($q=0;$q<$fieldNum;$q++){
$fieldName = mysql_field_name($query1, $q);
$name [] = $fieldName;
}
$output1 = explode (" ",$name);
foreach ($value as $arrVal) {
$total [] = $arrVal;
}
$output = explode("", $total);
echo "UPDATE $table SET";
for($a=0;$a<$fieldNum;$a++){
$akhir = "$output1".$a." = $output".$a."";
$akhir1 [] = $akhir;
}
$akhir2 = implode (",",$akhir1);
echo $akhir2;
echo " WHERE Kode_$table='$id'";
}
?>
But, when I'm running my program I got 2 notifications like this -->
Warning: explode() expects parameter 2 to be string, array given in C:\xampp\htdocs\Proyek 2\cobalagi\koneksi_class.php on line 88
Warning: explode() expects parameter 2 to be string, array given in C:\xampp\htdocs\Proyek 2\cobalagi\koneksi_class.php on line 93 UPDATE anggota SET0 = 0,1 = 1,2 = 2 WHERE Kode_anggota='10000'
What should I do?