Bonjour à tous,

Après scrapper des données je souhaite les insérer dans ma bdd. Du coup je récupère tout une ligne de donné qui contient mes 9 champs de ma table. Lors que j'exécute le code j'ai une erreur :
Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 Erreur de syntaxe prs de ''.Array.''
Voici mon code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function table_but_exact($lien_exact)
        {
 
            foreach ($lien_exact as $lien2) {
                $html = new simple_html_dom();
                $html->load_file($lien2);
                $csv = [];
                $tr = $html->find('#btable', 0);
                foreach ($tr->find('tr') as $item) {
                    $td = $item->find("td");
                    $temp = [];
                    for ($i = 0; $i < sizeof($td); $i++) {
                        if ($i <> 2) {
                            $text = $td[$i]->text();
                            $text = trim($text);
                            $text = str_replace(",", "", $text);
                            $text = str_replace("%", "", $text);
                            $text = str_replace("&nbsp;", "", $text);
                            $text = str_replace('(', "", $text);
                            $text = str_replace(')', "", $text);
 
                            array_push($temp, $text);
                        }
                    }
                    if (sizeof($td) > 8) {
                        $csv[] = $temp;
                    }
                }
                $pdo = new PDO('mysql:host=localhost;dbname=resultat_stats', 'root', '');
                foreach ($csv as $data) {
                    $ajouter = "INSERT INTO but_exact VALUE '.$data.'";
                    $preparedajouter = $pdo->prepare($ajouter);
                    $preparedajouter->execute();
                }
            }
        }
Je ne sais pas si j'en suis loin. Si vous pouvez m'aider j'en serai ravi.

Merci d'avance, bonne soirée.