2016-03-14 79 views
0
$upload_files=implode(' ',$_GET['upload_files']); 
$upload_user=",".$_GET['upload_user']; 
echo $upload_files; 
$sql = "UPDATE {$db_pr}files SET userID = CONCAT(userID,'".$upload_user."') WHERE id IN ('".$upload_files."')"; 

回答

0

IN採用以逗號分隔的字符串,我相信。

嘗試:

$upload_files=implode("','",$_GET['upload_files']); 
-1
Well, I got the solution. I used for loop to achieve the result. 

$upload_files=$_GET['upload_files']; 
$upload_user=",".$_GET['upload_user']; 
for ($i = 0, $count = count($upload_files); $i <= $count; $i++) { 
$sql = "UPDATE {$db_pr}files SET userID = CONCAT(userID,'".$upload_user."') WHERE id = '".$upload_files[$i]."'"; 
$result = mysqli_query($mysqli,$sql) or die("Error occurred - tried to update file."); 

} 
echo "<div class='loginMessage loginSuccess'>Assigned Successfully!!!</div>"; 
相關問題