Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 13
  1. #1

    Php errore di sintassi Aiuto Urgente

    Ciao a tutti chiedo aiuto ai più esperti per risolvere un problema, ho aggiornato una pagina php con carrello per gli acquisti ma quando carico la pagina mi dà quastra scritta: Parse error: syntax error, unexpected '=', expecting ',' or ';' in D:\inetpub\webs\baufioccom\prodotti\cartpro.php on line 177

    allora ho aperto l'editor php e sono andato alla riga che mi indica ma non so dov'è l'errore qualcuno sa aiutarmi? questa è la riga presa dall'editor php
    <input name=\"qta".$db- size="20">f("conf_id")."\" type=\"text\" id=\"textfield\" value=\"".$qta."\" size=\"5\" maxlength=\"4\" class=\"textbox\"></td>\n";
    else echo "<td align=\"center\">".$qta."</td>\n";
    $stot=$prezzo*$qta;$totale+=$stot; $pes+=$pesuni*$qta;
    echo "<td align=\"right\">".eur($stot)."</td>\n";
    echo "</tr>\n";
    }

    spero che possiate aiutarmi grazie in anticipo

  2. #2
    Codice PHP:
    <input name=\"qta".$dbsize="20">f("conf_id")."\" type=\"text\" id=\"textfield\" value=\"".$qta."\" size=\"5\" maxlength=\"4\" class=\"textbox\"></td>\n";
    else echo 
    "<td align=\"center\">".$qta."</td>\n";
    $stot=$prezzo*$qta;
    $totale+=$stot
    $pes+=$pesuni*$qta;
    echo 
    "<td align=\"right\">".eur($stot)."</td>\n";
    echo 
    "</tr>\n";

    qual è precisamente la rica 177?? comq ti consiglio di controllare un po questa riga

    Codice PHP:
    <input name=\"qta".$dbsize="20">f("conf_id")."\" type=\"text\" id=\"textfield\" 

  3. #3
    la riga è esattamente quella, il mio problema è che non so dov'è il problema! sai indirizzarmi o dirmi come risolvere?

    questa è la riga completa:

    <input name=\"qta".$db- size="20">f("conf_id")."\" type=\"text\" id=\"textfield\" value=\"".$qta."\" size=\"5\" maxlength=\"4\" class=\"textbox\"></td>\n";

  4. #4
    questa riga, html parlando non ha senso...la sintassi è errata...

  5. #5
    grazie, ma io ho bisogno di sapere come risolvere il problema! che non funziona lo so già, il fatto è che non sono un programmatore e di codice php non ne capisco nulla, in oltre la riga in questione non l'ho neanche toccata, se vi serve altro per aiutarmi ditemelo che inserisco il codice grazie

  6. #6
    eccoti la soluzione...ma continuo a dirti che l'html in quella riga non ha senso...

    Codice PHP:
    echo "<input name=\"qta\"".$db." size=\"20\">".f("conf_id")."\" type=\"text\" id=\"textfield\" value=\"".$qta."\" size=\"5\" maxlength=\"4\" class=\"textbox\"></td>\n";
    else echo 
    "<td align=\"center\">".$qta."</td>\n";
    $stot=$prezzo*$qta;$totale+=$stot$pes+=$pesuni*$qta;
    echo 
    "<td align=\"right\">".eur($stot)."</td>\n";
    echo 
    "</tr>\n"

  7. #7
    non capisco? il codice non funziona dove sbaglio?

    che vuoi dire che il codice html non ha senso?

  8. #8
    innanzitutto $db cos'è?
    qui poi viene chiuso il tag: size=\"20\">
    ma tutto quello che viene dopo farebbe parte del tag precedente...

  9. #9
    ti spiego, la pagina dei prodotti che devo visualizzare è collegata a un carrello elettronico, sono andato ad aggiornare i prezzi di spedizione e nel momento in cui ho provato mi ha dat l'errore, db dovrebbe essere il database dove vengono memorizzati gli ordini su mysql, uso frontpage per visualizzae il codice della pagina, ho inserito il codice che mi hai postato tu con copia incolla ma nulla da fare.

    il sito non l'ho fatto io e ho combinato quest casico che devo risolvere...

  10. #10
    la pagina è la seguente:

    var $squery;
    var $dati;

    function connect() {
    mysql_connect ($this->Host, $this->User, $this->Password) or die ($this->errore_server ());
    mysql_select_db($this->Database);
    }

    function query($sql) {
    $this->connect();
    $this->squery = mysql_query($sql) or die ($this->errore_server ());
    }

    function query_prod($id) {
    $sql = "SELECT * FROM ecom_prodotti WHERE prod_id='".$id."'";
    $this->query($sql);
    $this->next_record();
    }

    function next_record() {
    $this->dati = mysql_fetch_array($this->squery, MYSQL_ASSOC);
    return $this->dati;
    }

    function f($Field_Name) {
    return $this->dati[strtolower($Field_Name)];
    }

    function p($Field_Name) {
    print $this->f($Field_Name);
    }

    // funzione per errore server mysql
    function errore_server() {
    echo "Il database MySql sembra non rispondere...
    MySql dice:
    <font color=red>";
    echo mysql_error();
    echo "</font>
    pregasi <a href=\"mailto:gianluca@writeme.com\">segnalare</a> il problema";
    }

    }

    function eur($numero) {
    return number_format($numero, 2, ',', '.');
    }

    function cat_nome($id) {
    $db = new DB;
    $sql="SELECT cat_nome FROM ecom_categorie WHERE cat_id='".$id."'";
    $db->query($sql);
    $db->next_record();
    return $db->p("cat_nome");
    }

    function prod_nome($id) {
    $db = new DB;
    $sql="SELECT prod_nome FROM ecom_prodotti WHERE prod_id='".$id."'";
    $db->query($sql);
    $db->next_record();
    return $db->p("prod_nome");
    }

    function prod_desc($id_prod) {
    $desc = "";
    $db = new DB;
    $sql="SELECT * FROM ecom_prodotti WHERE prod_id='".$id_prod."'";
    $db->query($sql);
    $db->next_record();
    $desc = $db->f("prod_nome");
    $sql="SELECT cat_nome FROM ecom_categorie WHERE cat_id='".$db->f("cat_id")."'";
    $db->query($sql);
    $db->next_record();
    $desc = $db->f("cat_nome")." ".$desc;
    return $desc;
    }

    function conf_display($id) {
    $db = new DB;
    $sql="SELECT * FROM ecom_confezioni WHERE prod_id='".$id."' ORDER BY conf_order";
    $db->query($sql);
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">\n";
    while ($db->next_record()) {
    echo "<tr class=\"text\" bgcolor=\"#FFFF99\">\n";
    echo "<td align=\"left\">".$db->f("conf_nome")."</td>\n";
    echo "<td align=\"right\">&euro;".$db->f("conf_costo")."</td>\n";
    echo "<td align=\"right\"><a href=\"carrello.php?id=".$db->f("conf_id")."\">acquista</font></a></td>\n";
    echo "</tr>\n";
    }
    echo "</table>\n";
    }

    // carrello

    class Cart {
    var $items;
    var $tot;
    var $total;
    var $peso;
    var $italia;

    // add product(s) to the cart
    function addqta($id, $qta) {
    if($qta > 0)
    $this->items[$id] += $qta;
    }

    function add($id) {
    $this->addqta($id,1);
    }

    // remove $qty product(s) from the cart
    function set($id, $qta) {
    $this->items[$id] = $qta;
    }

    function remove($id) {
    unset($this->items[$id]);
    }

    function svuota() {
    $this->items=array();
    }

    function getqta($id) {
    return $this->items[$id];
    }

    function gettotal() {
    return $this->total;
    }

    function getitems() {
    return $this->items;
    }

    function vuoto() {
    if (count($this->items)>0) return FALSE;
    else return TRUE;
    }
    }

    class MyCart extends Cart {

    function display($mod) {
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">\n";
    echo "<tr align=\"center\" bgcolor=\"#FFCC66\" class=\"textbold\">";
    if ($this->vuoto()) {
    echo "<td align=\"center\"> Il carrello è vuoto</td>";
    }
    else {
    $totale = 0; $pes = 0;
    $ids = ""; // holds all the product ids in the cart
    foreach($this->items as $id => $qta)
    $ids .= ",$id";
    $ids = substr($ids, 1);
    $db = new DB;
    $sql = "SELECT * FROM ecom_confezioni WHERE conf_id IN (" . $ids . ")";
    $db->query($sql);
    echo "<td width=\"65%\">Prodotto</td><td width=\"12%\">Prezzo</td><td width=\"12%\">Quantit&agrave;</td>
    <td width=\"13%\" align=\"center\">Totale</td></tr>";
    while ($db->next_record()) {
    echo "<tr class=\"text\" bgcolor=\"#FFFF99\">\n";
    echo "<td align=\"left\">".prod_desc($db->f("prod_id"))."
    ".$db->f("conf_nome")."</td>\n";
    $prezzo=$db->f("conf_costo"); $pesuni=$db->f("conf_peso");
    echo "<td align=\"center\">&euro;".eur($prezzo)."</td>\n";
    $qta=$this->items[$db->f("conf_id")];
    if ($mod)
    echo "<td align=\"center\">
    <input name=\"qta".$db- size="20">f("conf_id")."\" type=\"text\" id=\"textfield\" value="".$qta."\" size=\"5\" maxlength=\"4\" class=\"textbox\"></td>\n";
    else $message.= "<td align=\"center\">".$qta."</td>\n";
    $stot=$prezzo*$qta;$totale+=$stot; $pes+=$pesuni*$qta;
    $message.= "<td align=\"right\">".eur($stot)."</td>\n";
    $message.= "</tr>\n";
    }
    $this->tot=$totale;$this->peso=$pes;
    echo "<tr>";
    if ($mod) {
    echo "<td colspan=\"2\"></td>";
    echo "<td colspan=\"2\" align=\"right\" bgcolor=\"#FFFF99\">

    Totale:";
    if ($totale!="") echo eur($totale); else echo eur(0);
    echo "
    </p></td>";
    }
    else {
    echo "<td class=\"text\"></td>";
    echo "<td class=\"text\" colspan=\"2\" align=\"right\" bgcolor=\"#FFFF99\">Subtotale:
    Spese di spedizione:
    I.V.A.:
    Totale</td>";
    echo "<td class=\"text\" align=\"right\" bgcolor=\"#FFFF99\">";
    if ($totale!="") echo eur($totale); else echo eur(0);echo "
    ";
    $spese=$this->spe($this->italia);$totale+=$spese;
    if ($spese!="") echo eur($spese); else echo eur(0);echo "
    ";
    $iva=$totale*0.2;
    if ($iva!="") echo eur($iva); else echo eur(0);echo "
    ";
    $totale += $iva;
    if ($totale!="") echo eur($totale); else echo eur(0);echo "
    ";
    echo "</td>";
    $this->total=$totale;
    }
    } // else
    echo "</tr></table>\n";

    return; // $ids;
    } // display()

    function spe($ita) {
    $p=$this->peso;
    if ($ita) {
    if ($p < 1) $spese = 0.00;
    else if ($p <= 10) $spese = 5.16;
    else if ($p > 10 and $p <= 20) $spese = 6.90;
    else if ($p > 20 and $p <= 50) $spese = 11.62;
    else if ($p > 50 and $p <= 100) $spese = 17.22;
    else if ($p > 100 and $p <= 200) $spese = 30.99;
    else if ($p > 200 and $p <= 300) $spese = 43.38;
    else if ($p > 300 and $p <= 500) $spese = 74.37;
    }
    else {
    if ($p <= 10) $spese = 17.22;
    else if ($p > 10 and $p <= 20) $spese = 34.44;
    else if ($p > 20 and $p <= 50) $spese = 68.88;
    }
    return $spese;
    } //spe

    function mailca($mod) {
    $message.= "";
    $message.= "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">\n";
    $message.= "<tr align=\"center\" bgcolor=\"#FFCC66\" class=\"textbold\">";
    if ($this->vuoto()) {
    $message.= "<td align=\"center\"> Il carrello è vuoto</td>";
    }
    else {
    $totale = 0; $pes = 0;
    $ids = ""; // holds all the product ids in the cart
    foreach($this->items as $id => $qta)
    $ids .= ",$id";
    $ids = substr($ids, 1);
    $db = new DB;
    $sql = "SELECT * FROM ecom_confezioni WHERE conf_id IN (" . $ids . ")";
    $db->query($sql);
    $message.= "<td width=\"65%\">Prodotto</td><td width=\"12%\">Prezzo</td><td width=\"12%\">Quantit&agrave;</td>
    <td width=\"13%\" align=\"center\">Totale</td></tr>";
    while ($db->next_record()) {
    $message.= "<tr class=\"text\" bgcolor=\"#FFFF99\">\n";
    $message.= "<td align=\"left\">".prod_desc($db->f("prod_id"))."
    ".$db->f("conf_nome")."</td>\n";
    $prezzo=$db->f("conf_costo"); $pesuni=$db->f("conf_peso");
    $message.= "<td align=\"center\">&euro;".eur($prezzo)."</td>\n";
    $qta=$this->items[$db->f("conf_id")];
    if ($mod)
    $message.= "<td align=\"center\">
    <input name=\"qta".$db- size="20">f("conf_id")."\" type=\"text\" id=\"textfield\" value="".$qta."\" size=\"5\" maxlength=\"4\" class=\"textbox\"></td>\n";
    else $message.= "<td align=\"center\">".$qta."</td>\n";
    $stot=$prezzo*$qta;$totale+=$stot; $pes+=$pesuni*$qta;
    $message.= "<td align=\"right\">".eur($stot)."</td>\n";
    $message.= "</tr>\n";
    }
    $this->tot=$totale;$this->peso=$pes;
    $message.= "<tr>";
    if ($mod) {
    $message.= "<td colspan=\"2\"></td>";
    $message.= "<td colspan=\"2\" align=\"right\" bgcolor=\"#FFFF99\">

    Totale:";
    if ($totale!="") $message.= eur($totale); else $message.= eur(0);
    $message.= "
    </p></td>";
    }
    else {
    $message.= "<td class=\"text\"></td>";
    $message.= "<td class=\"text\" colspan=\"2\" align=\"right\" bgcolor=\"#FFFF99\">Subtotale:
    Spese di spedizione:
    I.V.A.:
    Totale</td>";
    $message.= "<td class=\"text\" align=\"right\" bgcolor=\"#FFFF99\">";
    if ($totale!="") $message.= eur($totale); else $message.= eur(0);$message.= "
    ";
    $spese=$this->spe($this->italia);$totale+=$spese;
    if ($spese!="") $message.= eur($spese); else $message.= eur(0);$message.= "
    ";
    $iva=$totale*0.2;
    if ($iva!="") $message.= eur($iva); else $message.= eur(0);$message.= "
    ";
    $totale += $iva;
    if ($totale!="") $message.= eur($totale); else $message.= eur(0);$message.= "
    ";
    $message.= "</td>";
    $this->total=$totale;
    }
    } // else
    $message.= "</tr></table>\n";

    return $message; // $ids;
    } // mailca()

    } // MyCart



    ?>

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.