Non, var_dump() affiche juste l'etat de la variable.
Le but est de trouver quelle partie de ton code pose probleme en trouvant a partir de quelle ligne la variable perd sa valeur.
Non, var_dump() affiche juste l'etat de la variable.
Le but est de trouver quelle partie de ton code pose probleme en trouvant a partir de quelle ligne la variable perd sa valeur.
Voilà j'ai un message d'erreur:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\infortech\account\traitement_commande.php on line 118
Il te faut quoi maintenant que j'ai fait ça?
Il perd pas sa valeur mais c'est message d'erreur.
Voilà ce que j'obtiens au maximum:
Array ( [id] => 22 [client] => julie.vaissier@aliceadsl.fr [date] => 2009-08-22 [total_ht] => 2.47 [total_ttc] => 2.95 [expedition] => )
au lieu de:
Array ( [id] => 22 [client] => julie.vaissier@aliceadsl.fr [date] => 2009-08-22 [total_ht] => 2.47 [total_ttc] => 2.95 [expedition] => ) string(4) "2.95"
Je perd jamais plus d'infos.
Quand tu n'as plus le string(4) "2.95" c'est que ta valeur a disparu.
Il faut que tu reperes a partir de quel ligne elle disparait.
Dès que je fais ceci:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 <?php $paramclient_commande = "0"; if (isset($_SESSION['MM_Username'])) { $paramclient_commande = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']); } mysql_select_db($database_infortech, $infortech); $query_commande = sprintf("SELECT * FROM shop_commande WHERE client='%s' ORDER BY shop_commande.id DESC", $paramclient_commande); $commande = mysql_query($query_commande, $infortech) or die(mysql_error()); $row_commande = mysql_fetch_assoc($commande); print_r ($row_commande); die();var_dump($row_commande['total_ttc']); ?>
Bon c'est fait sans le "die".
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <?php $paramclient_commande = "0"; if (isset($_SESSION['MM_Username'])) { $paramclient_commande = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']); } mysql_select_db($database_infortech, $infortech); $query_commande = sprintf("SELECT * FROM shop_commande WHERE client='%s' ORDER BY shop_commande.id DESC", $paramclient_commande); $commande = mysql_query($query_commande, $infortech) or die(mysql_error()); $row_commande = mysql_fetch_assoc($commande); print_r ($row_commande); ?>var_dump($row_commande['total_ttc']);
tu n'as pas compris :
- il faut descendre la ligne
- regarder si on a toujours la valeur
- si oui, descendre la ligne et regarder
- si non, tu as trouvé ou la valeur est perdu
C'est impossible. J'arrête pas de descendre et y a toujours rien.
Ca veut dire quoi "toujours rien" ? la valeur apparait toujours ou elle n'apparait jamais ?
Tu sais tu nous aurais montré le code on aurait evité ca.
La valeur est toujours là.
C'est pas que je veux pas le montrer le code mais je sais pas lequel tu veux. J'ai donné ceux qui me posent problèmes. Parce que des requêtes j'en ai pas mal.
Si tu mets le var_dump() juste avant le formulaire tu as quoi ?
Donc je vais te donner tout ce que j'ai sur ma page.
Ensuite:
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
59
60
61
62
63
64
65
66
67
68
69 <?php session_start(); $MM_authorizedUsers = ""; $MM_donotCheckaccess = "true"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && true) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "../login.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) $MM_referrer .= "?" . $QUERY_STRING; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } ?>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 <?php $paramclient_commande = "0"; if (isset($_SESSION['MM_Username'])) { $paramclient_commande = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']); } mysql_select_db($database_infortech, $infortech); $query_commande = sprintf("SELECT * FROM shop_commande WHERE client='%s' ORDER BY shop_commande.id DESC", $paramclient_commande); $commande = mysql_query($query_commande, $infortech) or die(mysql_error()); $row_commande = mysql_fetch_assoc($commande); print_r ($row_commande); var_dump($row_commande['total_ttc']); die(); ?>
Puis:
Et pour finir:
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 <?php if (isset($_SESSION['MM_Username'])) { mysql_select_db($database_infortech, $infortech); $query_commande = sprintf("SELECT id FROM shop_commande WHERE client ='".$_SESSION['MM_Username']."' ORDER BY id DESC"); $commande = mysql_query($query_commande, $infortech) or die(mysql_error()); $row_commande = mysql_fetch_assoc($commande); $totalRows_commande = mysql_num_rows($commande); mysql_select_db($database_infortech, $infortech); $query_panier = sprintf("SELECT shop_panier.*, shop_produits.prix_ht, shop_produits.prix_ttc, shop_produits.prix_ht*shop_panier.quantite AS total_ht, shop_produits.prix_ttc*shop_panier.quantite AS total_ttc FROM shop_panier INNER JOIN shop_produits ON shop_produits.id=shop_panier.article WHERE client = '".$_SESSION['MM_Username']."'"); $panier = mysql_query($query_panier, $infortech) or die(mysql_error()); $totalRows_panier = mysql_num_rows($panier); $compteur = 0; while ($row_panier = mysql_fetch_assoc($panier) and $compteur < $totalRows_panier) { $query_ligne_commande = sprintf("INSERT INTO shop_ligne_commande (commande, article, prix_ht, prix_ttc, quantite, total_ht, total_ttc) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($row_commande['id'], "int"), GetSQLValueString($row_panier['article'], "int"), GetSQLValueString($row_panier['prix_ht'], "double"), GetSQLValueString($row_panier['prix_ttc'], "double"), GetSQLValueString($row_panier['quantite'], "int"), GetSQLValueString($row_panier['total_ht'], "double"), GetSQLValueString($row_panier['total_ttc'], "double")); mysql_select_db($database_infortech, $infortech); $Result1 = mysql_query($query_ligne_commande, $infortech) or die(mysql_error()); $query_suppr_panier = sprintf("DELETE FROM shop_panier WHERE id=%s", GetSQLValueString($row_panier['id'], "int")); mysql_select_db($database_infortech, $infortech); $Result1 = mysql_query($query_suppr_panier, $infortech) or die(mysql_error()); $compteur = $compteur+1; } } ?>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 <form action="https://www.paypal.com/fr/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="webmaster@informatique-jhv.com"> <input type="hidden" name="item_name" value="<?php echo $row_commande['id']; ?>"> <input type="hidden" name="item_number" value="<?php echo $row_commande['client']; ?>"> <input type="hidden" name="amount" value="<?php echo $row_commande['total_ttc']; ?>"> <input type="hidden" name="currency_code" value="EUR"> <input type="hidden" name="return" value="http://www.accueil.com"> <input type="image" src="http://www.paypal.com/fr_FR/i/btn/x-click-but01.gif" name="submit" alt="Effectuez vos paiements via PayPal : une solution rapide, gratuite et sécurisée"> </form>
Il y a deux fois la requete $query_commande et dans la deuxieme, tu n'as que la colonne "id"
Retire tout ca :
et les controles evidemment
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 mysql_select_db($database_infortech, $infortech); $query_commande = sprintf("SELECT id FROM shop_commande WHERE client ='".$_SESSION['MM_Username']."' ORDER BY id DESC"); $commande = mysql_query($query_commande, $infortech) or die(mysql_error()); $row_commande = mysql_fetch_assoc($commande); $totalRows_commande = mysql_num_rows($commande);
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 print_r ($row_commande); var_dump($row_commande['total_ttc']); die();
Tu m'excuse Sabotage mais là j'ai mais petits yeux qui se ferment tous seuls.
Je regarde demain ce que tu viens de me donner.
Et peut-être si tu veux et peux encore m'aider ça serait sympa.
Mais déjà merci pour tout ce que tu as fais.
Super ça fonctionne en très grande partie. Maintenant dans la page paypal "ID" s'affiche et le montant total aussi. En revanche le "client" non.
Puis je voudrais savoir une dernière chose:
le client qui achète sur ma boutique, pour payer avec paypal il doit obligatoirement être inscrit à paypal?
Si oui, existe-t-il un moyen pour faire en sorte que mes client qui ne sont pas inscrits à paypal puissent payer tout de même?
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager