Visualizzazione dei risultati da 1 a 2 su 2

Discussione: 2 errori php

Visualizzazione discussione

  1. #1

    errore: Unknown column 'title' in 'field list'

    'sera a tutti... è la prima volta che scrivo... e lo faccio perchè sto sclerando (sono su questo codice da tutto il giorno, e pur avendo la soluzione sotto il naso (SICURAMENTE!!!) non riesco a vederla

    Problema: quando addo un "prodotto" esce questo Unknown column 'title' in 'field list' (ma io non ho colonne TITLE nel mio DB!!!)

    Vi posto i codici interessati:

    - dal DBQUERY.PHP

    <?php
    function InsertProduct($client, $data, $descriere1, $descriere2, $servicii, $link, $path_det, $path_off)
    {
    $strSql = "INSERT INTO products (client, data, descriere1, descriere2, servicii, link, path_det, path_off)";
    $strSql = $strSql . "VALUES ('". $client ."', '". $data ."', '". $descriere1 ."', '".$descriere2."', '".$servicii."', '".$link."', '".$path_det."', '".$path_off."')";
    return $strSql;
    }

    - dal manageproduct.php

    session_start();
    if (!readCookie('admin', $_SESSION['userid']))
    {
    header("location: index.php");
    }
    $dbConn = OpenConn();

    $submit = $_POST['_submit'];
    $id = $_POST['id'];
    $_client = $_POST['_client'];
    $_data = $_POST['_data'];
    $_descriere1 = $_POST['_descriere1'];
    $_descriere2 = $_POST['_descriere2'];
    $_servicii = $_POST['_servicii'];
    $_link = $_POST['_link'];

    $path_det = $_POST['path_det'];
    $path_off = $_POST['path_off'];
    if (isset($_POST['_delImg']))
    {
    $isDel = (bool)$_POST['_delImg'];
    } else {
    $isDel = false;
    }

    //Upload Immagine
    $fieldname = '_picture';
    if ($_FILES[$fieldname]['tmp_name'] != '')
    {
    $uploadsDirectory = $_SERVER['DOCUMENT_ROOT'] .'/newhanson/grafica/products/originals/';
    $uploadFilename = $uploadsDirectory.'_original.jpg';
    $errors = array(1 => 'php.ini max file size exceeded',
    2 => 'html form max file size exceeded',
    3 => 'file upload was only partial',
    4 => 'no file was attached');

    switch ($submit){
    case "Insert":
    $sqlstring = GetLastProduct();
    $result = mysql_query($sqlstring, $dbConn);
    $row = mysql_fetch_array($result);
    $imgId = (int)$row['id'] + 1;
    mysql_free_result($result);
    $uploadForm = 'product.php';
    break;
    case "Update":
    $imgId = $id; // retrive the current Id
    $uploadForm = 'product.php'. $imgId;
    break;
    }

    @is_uploaded_file($_FILES[$fieldname]['tmp_name'])
    or error('not an HTTP upload', $uploadForm);

    @getimagesize($_FILES[$fieldname]['tmp_name'])
    or error('only image uploads are allowed', $uploadForm);

    @move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename)
    or error('receiving directory insuffiecient permission', $uploadForm);
    // Create an Image from it so we can do the resize
    if (file_exists($uploadFilename)) {
    $src = imagecreatefromjpeg($uploadFilename);

    imagejpeg($src,$uploadFilename,60);
    // Capture the original size of the uploaded image
    list($width,$height)=getimagesize($uploadFilename) ;

    // CREATE IMAGE 465x386
    $path_det = CreateUserImage($src, $width, $height, '465', '386', $_client, $imgId);
    // CREATE IMAGE 195x139
    $path_off = CreateUserImage($src, $width, $height, '195', '139', $_client, $imgId);
    imagedestroy($src);
    } else {
    error('File not exist', $uploadForm);
    }
    }

    if ($isDel) {
    $path_det = '';
    $path_off = '';
    }
    //inserimento prodotto
    switch ($submit)
    {
    case "Insert":
    $sSql = InsertProduct($_client, $_data, $_descriere1, $_descriere2, $_servicii, $_link, $path_det, $path_off);
    break;
    case "Update":
    $sSql = UpdateProduct($_client, $_data, $_descriere1, $_descriere2, $_servicii, $_link, $path_det, $path_off);
    break;
    }

    $result = mysql_query($sSql, $dbConn) or die('
    '. mysql_error() . '
    ');

    if ($submit == "Insert")
    {
    $sSql = GetLastProduct();
    $result = mysql_query($sSql, $dbConn);
    $row = mysql_fetch_array($result);
    $id = $row['id'];
    mysql_free_result($result);
    }

    header("location: product.php?id=". $id);

    CloseConn($dbConn);

    ?>

    - dal product.php

    session_start();
    if (!readCookie('admin', $_SESSION['userid']))
    {
    header("location: index.php");
    }
    $dbConn = OpenConn();

    if ( isset($_GET['id']) )
    {
    $id = $_GET['id'];
    } else
    {
    $id = 0;
    }

    if ($id != 0)
    {
    $sSqlProduct = GetProduct($id);
    $result = mysql_query($sSqlProduct, $dbConn);

    while ($row = mysql_fetch_array($result)){
    $client = $row['client'];
    $data = $row['data'];
    $descriere1 = $row['descriere1'];
    $descriere2 = $row['descriere2'];
    $servicii = $row['servicii'];
    $link = $row['link'];
    $path_det = $row['path_det'];
    $path_off = $row['path_off'];
    }

    mysql_free_result($result);
    } else{
    $client = '';
    $data = '';
    $descriere1 = '';
    $descriere2 = '';
    $servicii = '';
    $link = '';
    $path_det = '';
    $path_off = '';
    }


    [CUT]

    ?>


    E allego anche il printscreen del DB...

    Qualche anima pia che è arrivata fino a qua... può illuminarmi?!?!? SONO DISPERATA!!!
    Immagini allegate Immagini allegate

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.