<?php
ob_start("ob_gzhandler");
$idcomp = $_POST['idcomp'];
$compchar = $_POST['compchar'];
$Composer = $_POST['Composer'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$Birth = $_POST['Birth'];
$Nationality = $_POST['Nationality'];
$Opus = $_POST['Opus'];
$Publisher = $_POST['Publisher'];
$Oddities = $_POST['Oddities'];
$information = $_POST['information'];
$submit = $_POST['submit'];
$Composer = str_replace("'", "\'", $Composer);
$fname = str_replace("'", "\'", $fname);
$lname = str_replace("'", "\'", $lname);
$Birth = str_replace("'", "\'", $Birth);
$Nationality = str_replace("'", "\'", $Nationality);
$Opus = str_replace("'", "\'", $Opus);
$Publisher = str_replace("'", "\'", $Publisher );
$Oddities = str_replace("'", "\'", $Oddities);
$information = str_replace("'", "\'", $information );
include('connections.php');
//$compchar = $_GET['compchar'];
// get the actual date and time
$Tdate = getdate();
$entrydate = $Tdate["year"]."-".$Tdate["mon"]."-".$Tdate["mday"]." ".
$Tdate["hours"].":".$Tdate["minutes"].":".$Tdate["seconds"];
//$newidcomp = $numrows + 1;
// 001: Database insert query
$query = "update quartets set Composer='".$Composer."',".
"fname='".$fname."',".
"lname='".$lname."',".
"Birth='".$Birth."',".
"Nationality='".$Nationality."',".
"Opus='".$Opus."',".
"Publisher ='".$Publisher ."',".
"Oddities='".$Oddities."',".
"information ='".$information."' ".
"where idcomp=".$idcomp;
echo "<br>mod quartets query = " . $query;
// 002: Execute query
$res = mysql_query($query, $sqlConn);
//echo "$res = mysql_query($query, $sqlConn)";
if (!$res)
{
echo $query;
die ('Could not run query: ' . mysql_error());
}
mysql_freeresult($res);
mysql_close($sqlConn);
// everything went ok, so we can inform the user
$URL="/index.php?id=2&compchar=".$compchar;
header ("Location: $URL");
mysql_close($sqlConn);
echo("<p>Modifications have been stored</p>")
?>I understand the real escape thing to little. Can someone point out the error?But where is error text (echo mysql_error();)?
wikibooks(ru) Ditto(en) | Wayfinder e-book | Заметки и о MODxBut where is error text (echo mysql_error();)?
$Composer = $_POST['Composer'];
$Composer= mysql_real_escape_string($_POST['Composer']);
$information = "'", "\'", $information );
$information = mysql_real_escape_string(str_replace("'", "\'", $information ));
good question, where should that be?
I don’t know, where you have found it
But the moment backticks are used I get MySQL errors.

$Composer = $_POST['Composer'];
$Composer = str_replace("'", "\'", $Composer);
$Composer = addslashes($_POST['Composer']);
php_value magic_quotes_gpc off
wikibooks(ru) Ditto(en) | Wayfinder e-book | Заметки и о MODx
$array = str_replace("'", "\'", $array );<?php
ob_start("ob_gzhandler");
$idcomp = $_POST['idcomp'];
$compchar = $_POST['compchar'];
$Composer = $_POST['Composer'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$Birth = $_POST['Birth'];
$Nationality = $_POST['Nationality'];
$Opus = $_POST['Opus'];
$Publisher = $_POST['Publisher'];
$Oddities = $_POST['Oddities'];
$information = $_POST['information'];
$submit = $_POST['submit'];
include('connections.php');
// get the actual date and time
$Tdate = getdate();
$entrydate = $Tdate["year"]."-".$Tdate["mon"]."-".$Tdate["mday"]." ".
$Tdate["hours"].":".$Tdate["minutes"].":".$Tdate["seconds"];
// 001: Database insert query
$query = "update quartets set Composer='".$Composer."',".
"fname='".$fname."',".
"lname='".$lname."',".
"Birth='".$Birth."',".
"Nationality='".$Nationality."',".
"Opus='".$Opus."',".
"Publisher ='".$Publisher ."',".
"Oddities='".$Oddities."',".
"information ='".$information."' ".
"where idcomp=".$idcomp;
//this correct here?
echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
echo "<br>mod quartets query = " . $query;
// 002: Execute query
$res = mysql_query($query, $sqlConn);
if (!$res)
{
echo $query;
die ('Could not run query: ' . mysql_error());
}
mysql_freeresult($res);
mysql_close($sqlConn);
// everything went ok, so back to list page
$URL="/index.php?id=2&compchar=".$compchar;
header ("Location: $URL");
mysql_close($sqlConn);
echo("<p>Modifications have been stored</p>")
?>