Bonjour,

je ne sais pas si je suis sur le bon forum, mais j'ai un message d'erreur que je ne comprends pas entièrement. Voilà ce que ça dis :

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''6''' at line 3' in C:\xampp\htdocs\social_network\profile.php:43 Stack trace: #0 C:\xampp\htdocs\social_network\profile.php(43): PDOStatement->execute(Array) #1 {main} thrown in C:\xampp\htdocs\social_network\profile.php on line 43

Même en le traduisant mot pour mot, je ne comprends ce qu'il ne va pas, à part problème ligne 43 dans le fichier profile. Mais le reste.... ?

Bref je joins le code du fichier :
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 
<?php
session_start();
 
include('filters/auth_filter.php');
require("config/database.php");
require("includes/functions.php");
require('includes/constants.php');
 
if(isset($_GET['id'])){
	//Récupérer les infos sur l'user en bdd en utilisant son id
	$user = find_user_by_id($_GET['id']);
 
	if(!$user){
		redirect('index.php');
	}
}else{
	redirect('profile.php?id='.get_session('user_id'));
}
 
 
if (isset($_POST['update'])) {
	$errors = [];
	 //Si tous les champs ont été remplis
	 if (not_empty(['name', 'city','country','sex','bio'])) {
 
		 extract($_POST);
 
		 $q = $db->prepare("UPDATE users SET name = :name, city = :city, country = :country,
							sex= :sex, twitter = :twitter, github = :github, available_for_hiring = :available_for_hiring, 
							bio = :bio WHERE id = :id'");
 
		$q->execute(array(
					'name' => $name,
					'city' => $city,
					'country' => $country,
					'sex' => $sex,
					'twitter' => $twitter,
					'github' => $github,
					'available_for_hiring' => !empty($available_for_hiring) ? '1' : '0',
					'bio' => $bio,
					'id' => $_SESSION['user_id']
 
	 ));
		set_flash("Félicitations, votre profil a été mis à jour ! ");			
 
	}else{
		save_input_data();
		$errors[] = "Veuillez remplir tous les champs marqués d'un (*)";
	}
 
 } else {      
 
		clear_input_data();  
 
		} 
require("views/profile.view.php");
?>