Problema: quando addo un "prodotto" esce questo Unknown column 'title' in 'field list' (ma io non ho colonne TITLE nel mio DB!!!)... da cosa potrebbe dipendere?![]()
Problema: quando addo un "prodotto" esce questo Unknown column 'title' in 'field list' (ma io non ho colonne TITLE nel mio DB!!!)... da cosa potrebbe dipendere?![]()
E' proprio questo il problema.Originariamente inviato da heartbreaker777
...ma io non ho colonne TITLE nel mio DB!!!...
Posta la query
Addio Aldo, amico mio... [03/12/70 - 16/08/03]
Posto la parte che interessa l'Insert (se serve anche il resto, ditemelo)...
<?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;
}
Mmm posta la query così come restituita dalla funzione
Addio Aldo, amico mio... [03/12/70 - 16/08/03]
Siccome sono una neofitaE ci capisco poco
![]()
![]()
![]()
Questa e' tutta la DB QUERY (parecchio lunga)
<?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;
}
function InsertPresa($title1, $titlu2, $extract, $path_det, $path_off)
{
$strSql = "INSERT INTO presa (title1, titlu2, extract, path_det, path_off)";
$strSql = $strSql . "VALUES ('". $title1 ."', '". $titlu2 ."', '".$extract."', '".$path_det."', '".$path_off."')";
return $strSql;
}
function UpdateProduct($client, $data, $descriere1, $descriere2, $servicii, $link, $path_det, $path_off)
{
$strSql = "Update products SET client='".$client."', data='".$data."', descriere1='".$descriere1."', descriere2='".$descriere2."', servicii='".$servicii."', link='".$link."', path_det='".$path_det."', path_off='".$path_off."'";
$strSql = $strSql . " WHERE id = " . $id;
return $strSql;
}
function UpdatePresa($title1, $titlu2, $extract, $path_det, $path_off)
{
$strSql = "Update presa SET title1='".$title1."', titlu2='".$titlu2."', extract='".$extract."', path_det='".$path_det."', path_off='".$path_off."'";
$strSql = $strSql . " WHERE id = " . $id;
return $strSql;
}
function DeleteProduct($id)
{
$strSql = "DELETE FROM products WHERE id = " . $id;
return $strSql;
}
function DeletePresa($id)
{
$strSql = "DELETE FROM presa WHERE id = " . $id;
return $strSql;
}
function GetAllProducts()
{
$strSql = "SELECT * FROM products ";
return $strSql;
}
function GetAllPresa()
{
$strSql = "SELECT * FROM presa ";
return $strSql;
}
function GetProduct($id)
{
$strSql = "SELECT * FROM products ";
$strSql = $strSql . " WHERE id = " . $id;
return $strSql;
}
function GetPresa($id)
{
$strSql = "SELECT * FROM presa ";
$strSql = $strSql . " WHERE id = " . $id;
return $strSql;
}
function GetLastProduct()
{
$strSql = "SELECT MAX(id) as id FROM products ";
return $strSql;
}
function GetLastPresa()
{
$strSql = "SELECT MAX(id) as id FROM presa ";
return $strSql;
}
function GetUser($username, $password) {
$strSql = "SELECT * FROM users WHERE username = '" . $username . "' and password = '" . $password . "'";
return $strSql;
}
/* crea un cookie */
function SetLoginCookie($sCookieclient, $userid) {
setCookie($sCookieclient, $userid, time()+1200);
}
/* Legge un cookie */
function readCookie($sCookieclient, $userid) {
if (isset($_COOKIE[$sCookieclient])){
if ($_COOKIE[$sCookieclient] == $userid) {
return true;
}
else{
return false;
}
}
else{
return false;
}
}
// crea un'immagine ridimensionata
function CreateUserImage($src, $oWidth, $oHeight, $nWidth, $nHeight, $hName, $prodId) {
$tmp=imagecreatetruecolor($nWidth,$nHeight);
$path =$_SERVER['DOCUMENT_ROOT'] . "/newhanson/grafica/products/". $hName."/";
// Create Producer directory
if (!file_exists($path)){
mkdir($path, 0775);
}
// this line actually does the image resizing, copying from the original image into the $tmp image
imagecopyresampled($tmp,$src,0,0,0,0,$nWidth,$nHei ght,$oWidth,$oHeight);
// now write the resized image to disk. I have assumed that you want the resized, uploaded image file to reside in the ./images subdirectory.
$name= $path . $prodId."_".$nWidth."x".$nHeight.".jpg";
imagejpeg($tmp,$name,75);
imagedestroy($tmp); // NOTE: PHP will clean up the temp file it created when the request
$name= "/newhanson/grafica/products/". $hName."/". $prodId."_".$nWidth."x".$nHeight.".jpg";
return $name;
}
// The following function is an error handler which is used
// to output an HTML error page if the file upload fails
function error($error, $location, $seconds = 5)
{
header("Refresh: $seconds; URL=\"$location\"");
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"'."\n".
'"http://www.w3.org/TR/html4/strict.dtd">'."\n\n".
'<html lang="en">'."\n".
' <head>'."\n".
' <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">'."\n\n".
' <link rel="stylesheet" type="text/css" href="stylesheet.css">'."\n\n".
' <client>Upload error</client>'."\n\n".
' </head>'."\n\n".
' <body>'."\n\n".
' <div id="Upload">'."\n\n".
' <h1>Upload failure</h1>'."\n\n".
'
An error has occured: '."\n\n".
' <span class="red">' . $error . '...</span>'."\n\n".
' The upload form is reloading</p>'."\n\n".
' </div>'."\n\n".
'</html>';
exit;
} // end error handler
?>
Mentre qui il codice della pagina PRODUCT.PHP dove si fanno tutte le operazioni per addare![]()
<?php
include("../util/dbconn.php");
include("../util/dbquery.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 = '';
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="stylesheet" type="text/css" href="../css/pagine.css"/>
<script language="javascript">
function DeleteProduct(id)
{
var del = window.confirm("Vrei sa stergi proiectul selectat?");
if (del)
{
location.href= "deleteprod.php?type=prod&id=" + id;
}
}
</script>
<title>HANSON Admin</title>
</head>
<body>
<div id="containeradmin">
<form method="post" action="manageprod.php" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?php echo $id ?>">
<input type="hidden" name="path_det" value="<?php echo $path_det ?>">
<input type="hidden" name="path_off" value="<?php echo $path_off ?>">
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="50" colspan="3" class="verde">Adauga un nou proiect de webdesign</td>
</tr>
<tr>
<td height="50" colspan="3" valign="bottom"><span class="blu2">Nume client:</span>
<input type="text" name="_client" size="100" value="<?php echo $client;?>"> </td>
</tr>
<tr>
<td height="50" colspan="3" valign="bottom"><span class="blu2">Data cand a fost lansat proiectul:</span>
<input type="text" name="_data" size="50" value="<?php echo $data;?>"></td>
</tr>
<tr>
<td height="50" colspan="3" valign="bottom"><span class="blu2">Scurta descriere (pentru Home, max 60 caracteri):</span>
<textarea name="_descriere1" cols="60"><?php echo $descriere1;?></textarea> </td>
</tr>
<tr>
<td height="50" colspan="3" valign="bottom"><span class="blu2">Descriere:</span>
<textarea name="_descriere2" cols="100" rows="10"><?php echo $descriere2;?></textarea> </td>
</tr>
<tr>
<td height="50" colspan="3" valign="bottom"><span class="blu2">Servicii oferiti:</span>
<textarea name="_servicii" cols="100"><?php echo $servicii;?></textarea>
</td>
</tr>
<tr>
<td height="50" colspan="3" valign="bottom"><span class="blu2">Site:</span>
<input type="text" name="_link" size="50" value="<?php echo $link;?>"></td>
</tr>
<tr>
<td height="30" colspan="3" valign="bottom" class="blu2">Screenshot</td>
</tr>
<?php
if ($path_det !='' && $path_off !='') {?>
<tr>
<td height="65"><span class="blu2">465x386</span>
[img]<?php echo $path_det;?>[/img] </td>
<td height="65"><span class="blu2">195x139</span>
[img]<?php echo $path_off;?>[/img] </td>
<td height="65"><span class="blu2">Sterge poza</span>
<INPUT TYPE="checkbox" NAME="_delImg" value="1"> </td>
</tr>
<?php
}
?>
<tr>
<td height="35" colspan="3">
<input type="file" name="_picture" size="60"> </td>
</tr>
<tr>
<td height="35">
<?php
if ($id != 0){
echo '<input type="submit" name="_submit" value="Update">';
} else {
echo '<input type="submit" name="_submit" value="Insert">';
}
?> </td>
<td height="35"></td>
<td height="35"><input type="reset" name="_clear" value="Clear"></td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="3"><div align="right">Lista de proiecte postate</div></td>
</tr>
</table>
</form>
</div>
</body>
</html>
<?php
CloseConn($dbConn);
?>
Ho risolto!!!
Caricavo un altro file di query![]()
![]()
![]()
Che stordita che sono!!!![]()
Grazie comunque![]()