by one queryWell, i got two php functions. Both of them should insert some values into DB tables. So the first one
mysql_query("INSERT INTO images (thumb) VALUES ('$path')");
doing thins in cycle.
But then i nedd to add some values in other column but the problem is that all of thouse values stores in array. That how function was look like.
function uploading_paths($names_array){
$data = '(\'' . implode('\'),(\'', $names_array) . '\')';
mysql_query("INSERT INTO `images` (`image_path`) VALUES $data");
}
So how can I add values from $data array in rows with already filled thumb columns by one query?
Is it possible?
Try using PHP PDO for this. It lets you prepare a statement and then execute it as many times as you want. Example:
Eventually you could replace the last path by:
… and you won`t have to supply the array of execute in the order you have the fields.
Regards !