Closed. This question is off-topic。它当前不接受答案。
                            
                        
                    
                
                            
                                
                
                        
                            
                        
                    
                        
                            想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
                        
                        5年前关闭。
                                                                                            
                
        
我在爆炸行中遇到解析错误。
我只想使用已经存储在数据库中的关键字(布拉德·皮特,搏击俱乐部,项目混乱),然后将其转换为逗号分隔的数组。然后将该数组与新的用户输入合并。

<?php
$tags = $_POST['tagArray'];
$title = $_POST['title'];

$DBServer = "localhost";
$DBUser = "------";
$DBPass = "-------";
$DBName = "movies";

$conn = mysqli_connect($DBServer, $DBUser, $DBPass, $DBName);


$query = "SELECT keywords FROM movieTitles WHERE movie='" .$title. "'";
$result = mysqli_query($conn, $query);
$row = mysqli_fetch_array($result);
$keywords = $row['keywords'];

$current = explode("," $keywords[0]);
$array = array_unique(array_merge($tags,$current));

echo $array;

mysqli_close($conn);

?>

最佳答案

$current = explode(",", $keywords[0]);


您错过了一个逗号

09-29 19:20