Problema update baza de date
Scris: Dum Feb 06, 2011
Am o problema care nu o mai inteleg...am codul asta:
Imi da erroarea asta:
M-am uitat la linia asta:
dar degeaba...e fix cum e in db...chiar nu mai stiu ce sa ii fac....
Cod: Selectaţi tot
<?php
include("config.php");
?>
<?php
// Intai faceti conectarea la MySQL si selectarea bazei de date
$conn = mysql_connect("localhost", "root", "")
or die("Unable to connect to MySQL");
$selectdb = mysql_select_db('scoala');
// Daca sunt trimise datele pt. 'nume' si 'e-mail' din formular
if (isset($_POST['adm_name']) && isset($_POST['adm_email'])) {
$adm_name = $_POST['adm_name'];
$adm_email = $_POST['adm_email'];
$copyright = $_POST['copyright'];
$site_name = $_POST['site_name'];
$nimica = "nimica";
// Se verifica daca "magic_quotes_gpc()" nu este setat ON
// Daca nu e ON, se filtreaza variabilele cu addslashes()
if(!get_magic_quotes_gpc()) {
$adm_name = addslashes($adm_name);
$adm_email = addslashes($adm_email);
$copyright = addslashes($copyright);
$site_name = addslashes($site_name);
$nimica = addslashes($nimica);
}
// Acum se adauga mai in siguranta aceste date in MySQL
$sql = "UPDATE `informations` (about_us, home_page, site_name, copyright, administrator_email, administrator_n) VALUES ('$nimica', '$nimica', '$site_name', '$copyright', '$adm_email', '$adm_name')";
// Se executa interogarea, daca returneaza FALSE afisaza cauza erorii, altfel, afiseaza confirmarea
if (!mysql_query($sql)) {
echo 'Eroare : '. mysql_errno(). ' - '. mysql_error();
}
else {
echo 'Stirea a fost adaugata cu succes';
}
}
@mysql_close();
?>
Cod: Selectaţi tot
Eroare : 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(about_us, home_page, site_name, copyright, administrator_email, administrator_n' at line 1
Cod: Selectaţi tot
$sql = "UPDATE `informations` (about_us, home_page, site_name, copyright, administrator_email, administrator_n) VALUES ('$nimica', '$nimica', '$site_name', '$copyright', '$adm_email', '$adm_name')";