hello dear Friends i just discover this forum i don't know more about how it work here, i need help to complete my website
i created a shopping cart with php in dreamweaver with generated code all work fine customer can add product to cart and edit quantity , see the total price and delete item in shopping cart, and i create a boutton where customer can validate the order. but i get a error message i can't solve it i'm not good in php and generaly in programation my english is not so good thank you to help me i give the error here and the php code ( ! ) SCREAM: Error suppression ignored for
( ! ) Warning: sprintf() [<a href='function.sprintf'>function.sprintf</a>]: Too few arguments in C:\wamp\www\myspace\order-line.php on line 127
Call Stack

( ! ) SCREAM: Error suppression ignored for
( ! ) Warning: sprintf() [<a href='function.sprintf'>function.sprintf</a>]: Too few arguments in C:\wamp\www\myspace\order-line.php on line 127
Call Stack

1   0.0021  419720  {main}( )   ..\order-line.php:0
2   0.0083  427008  sprintf ( ) ..\order-line.php:127
Query was empty
here is the code of order-line 
<?php 
session_start(); ?>
<?php
if (!isset($_SESSION)) {
  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 = "failed.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($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) 
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php 
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Document sans titre</title>
</head>

<body>
<?php
if (isset ($_SESSION['MM_Username'])) {
    $hostname_marketbase = "localhost";
$database_marketbase = "zunaphone";
$username_marketbase = "root";
$password_marketbase = "";
$marketbase = mysql_pconnect($hostname_marketbase, $username_marketbase, $password_marketbase) or trigger_error(mysql_error(),E_USER_ERROR); 
    mysql_select_db($database_marketbase, $marketbase);
    $query_commande = sprintf ("SELECT id 
    FROM commande
    WHERE client ='".$_SESSION['MM_Username']."'
    ORDER BY id DESC");
    $commande = mysql_query($query_commande, $marketbase) or die (mysql_error ());
    $row_commande = mysql_fetch_assoc ($commande);
    $rotalRows_commande = mysql_num_rows ($commande);
    mysql_select_db($database_marketbase, $marketbase);
    $query_panier = sprintf ("SELECT panier.*,
    phone.titre,
    phone.sku,
    phone.prix,
    phone.shipping,
    phone.prix*panier.quantite AS subtotal,
    phone.prix*panier.quantite+phone.shipping AS total
    FROM panier
    INNER JOIN phone
    ON phone.sku = panier.SKU
    WHERE client = '".$_SESSION['MM_Username']."'");
    $panier = mysql_query ($query_panier, $marketbase) or die (mysql_error());
    $totalRows_panier = mysql_num_rows ($panier);
    $compteur = 0;
    while ($row_panier = mysql_fetch_assoc($panier) and $compteur <$totalRows_panier)
    {
        $query_lignecommande = sprintf (" INSERT
        INTO lignecommande(commande,article,quantite,prix,subtotal,total) VALUES (%s, %s, %s, %s, %s, %s, %s)",
        GetSQLValueString($row_commande['id'],"int"),
        GetSQLValueString($row_panier['article'], "int"),
GetSQLValueString($row_panier['quantite'],"int"),
GetSQLValueString($row_panier['prix'],"double"),
GetSQLValueString($row_panier['subtotal'],"double"),
GetSQLValueString($row_panier['total'],"double"));
    mysql_select_db($database_marketbase, $marketbase);
    $Result1 = mysql_query($query_lignecommande, $marketbase) or die (mysql_error());
    $query_suppr_panier = sprintf ("DELETE FROM panier WHERE id=%s",
                                   GetSQLValueString($row_panier['id'], "int"));
    mysql_select_db($database_marketbase, $zmarketbase);
    $Result = mysql_query ($query_suppr_panier, $marketbase) or die (mysql_error());
    $compteur= $compteur+1;
    }
}
?>
</body>
</html>
<?php 
mysql_free_result($panier);
mysql_free_result($commande);
?>
Re: i created a shopping cart with php in dreamweaver and i have a error 80 80

one to many %s

$query_lignecommande = sprintf (" INSERT
INTO lignecommande(commande,article,quantite,prix,subtotal,total) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($row_commande['id'],"int"),
GetSQLValueString($row_panier['article'], "int"),
GetSQLValueString($row_panier['quantite'],"int"),
GetSQLValueString($row_panier['prix'],"double"),
GetSQLValueString($row_panier['subtotal'],"double"),
GetSQLValueString($row_panier['total'],"double"));
Re: i created a shopping cart with php in dreamweaver and i have a error 80 80

thank you to reply me it work on local but i have litle problem on server

   Fatal error: in /homepages/0/d461548742/htdocs/zunaphone.com/myspace/order-line.php on line 98

to line 94-98 i use hostname, username, database name, and password

Re: i created a shopping cart with php in dreamweaver and i have a error 80 80

can somebody help me please ???

Re: i created a shopping cart with php in dreamweaver and i have a error 80 80
Member Avatar

to line 94-98 i use hostname, username, database name, and password

You need to make sure that your hostname, username, database name, and password is valid on your database on your host server

Re: i created a shopping cart with php in dreamweaver and i have a error 80 80

That can't be the whole error? Don't hold out on us; no part of an error message is irrelevant, and the more we know the better we can answer you.

Also, just to point this out, that code is kind of a mess. There's a complete lack of a sane coding style, which makes it a pain to read. (And readability is hugely important for code!) You also seem to be using sprintf unnecessarily all over the place. - Code generated by DW tends to be this way, in my experience, which is why I always recommend against using it.

Re: i created a shopping cart with php in dreamweaver and i have a error 80 80

thank i will find more about it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.