edit, saw to late this is an Efrom sub forum. Sorry missplaced it.
Hi
I have some scripts to insert data (names) through a form and display that data.
When I insert data all goes well. As soon as names have a ’or ` or " this is inserted in the db, I can see it. But it does not get displayed on the webpage.
If I change it through PHPmyadmin from eg tést to test it does appear on the webpage?
Modx 9.6.1p2
modx character enc: iso-8895-1
in config.inc.php: $database_connection_charset = ’latin1’;
db collation is set to latin1-swedish-ci
tables fields are set to latin1-swedish-ci
Here one of the tables with that problem:
idcomp int(11) No
Composer varchar(255) Yes NULL
Birth varchar(255) Yes NULL
Nationality varchar(255) Yes NULL
Opus varchar(255) Yes NULL
Publisher varchar(255) Yes NULL
Oddities varchar(255) Yes NULL
Fname varchar(255) Yes NULL
Lname varchar(255) Yes NULL
What is wrong here?
Heres the script that is reading and displaying the data:
<?php
$idcompdetails = $_GET['idcd'];
$idcdelete = $_GET ['idcdel'];
$idcompmod = $_GET['idcmod'];
$idcomp = $_GET['idcomp'];
$compchar = $_GET['compchar'];
if (strlen($compchar) > 0)
{
$select_subset = true;
$letter = strtoupper(substr($compchar,0,1));
if (is_numeric($letter))
$first_is_number = true;
else $first_is_number = false;
}
else $select_subset = false;
include('connections.php');
//$result = mysql_query($sql) or die('ERROR: '.$query.' '.mysql_error());
$letterlinks = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
echo '<a Composer="top"></a>';
echo '<a href="index.php?id=2&compchar=0">0-9</a> ';
for ($i = 0; $i < 26; $i++):
echo '<a href="index.php?id=2&compchar='.$letterlinks[$i].'">'.$letterlinks[$i].'</a> ';
endfor;
/*while
($list = mysql_fetch_object($result)):
$letter = strtoupper(substr($list->Composer, 0, 1));
if ($prev_row != '0-9' && is_numeric($letter)):
echo '<br /><a Composer="number"></a><b><u>0-9</u></b> ';
echo '<a href="#top"><i>goto top</i></a><br />';
$prev_row = '0-9';
endif;
if ($letter != $prev_row && !is_numeric($letter)):
echo '<br /><a Composer="'.$letter.'"></a><b><u>'.$letter.'</u></b> ';
echo '<a href="#top"><i>goto top</i></a><br />';
$prev_row = $letter;
endif;
echo $list->Composer.'<br />';
endwhile;*/
//echo "<br>select_subset = " . $select_subset;
if ($select_subset)
{
// 001: Database query
if ($first_is_number)
$query = "select * from quartets WHERE lname >= '0%' and lname <= '9%'";
else $query = "select * from quartets WHERE lname like '".$compchar."%'";
$query .= " order by lname ASC";
//echo "<br>query = " . $query;
// 002: Execute query
$res = mysql_query($query, $sqlConn);
if (!$res)
{
die ('Could not run query: ' . mysql_error());
}
echo "<br><br>";
echo " <table border=\"0\" align=\"left\" width=\"580\"valign=\"left\" color=\"#fafafa\" cellpadding=\"10\" cellspacing=\"2\">";
echo " <thead>";
echo " <tr>";
echo " <th scope=\"row\" bgcolor=\"#cccccc\">Last Name</th>";
echo " <th scope=\"row\" bgcolor=\"#cccccc\">First Name</th>";
echo " <th scope=\"row\" bgcolor=\"#cccccc\">Composition</th>";
echo " <th scope=\"row\" bgcolor=\"#cccccc\">Options</th>";
echo " </tr>";
echo " </thead>";
echo " <tbody>";
$i = 0;
while ($row = mysql_fetch_array($res, MYSQL_BOTH))
while ($row = mysql_fetch_array($res, MYSQL_BOTH))
{
$idcomp = $row[0];
$Opus = $row[4];
$lname = $row[8];
$fname = $row[7];
echo " <tr>";
{
echo "
";
if($i%2 == 0)
{
echo "<tr bgcolor='#F4F6FA'>";
$i++;
}
else
{
echo "<tr bgcolor='#E9EDF5'>";
$i++;
}
}
echo " <td >".$lname."</td>";
echo " <td >".$fname."</td>";
echo " <td >".$Opus."</td>";
echo " <td ><a href=\"/index.php?id=".$idcompdetails."&idcomp=".$idcomp."&compchar=".$compchar."\">
<img src=\"http://www.pianoquartet.nl/assets/snippets/nbscripts/images/details.png\" alt=\"Vieuw $lname 's details\" title=\"Vieuw $name 's details\" style=\"border:0\"></a>";
// als $website niet leeg is..
if ($website ==!'') {
// laten we dit stukje zien
echo "<a href=\"http://$website\" target=\"new\">
<img src=\"http://www.pianoquartet.nl/assets/snippets/nbscripts/images/www.png\" alt=\"Go to '.$name.' \'s website\" title=\"Go to '.$name.' 's website\" style=\"border:0\"></a>";
}
echo"
<a href=\"/index.php?id=".$idcompmod."&idcomp=".$idcomp."&compchar=".$compchar."\">
<img src=\"http://www.pianoquartet.nl/assets/snippets/nbscripts/images/edit.png\" alt=\"Edit $name 's details\" title=\"Edit $name 's details\" style=\"border:0\"></a>";
if ($email ==!'') {
echo "<a href=\"mailto:$email\">
<img src=\"http://www.pianoquartet.nl/assets/snippets/nbscripts/images/email.png\" alt=\"Email $name\" title=\"Email $name\" style=\"border:0\"></a>";
}
echo"
<a href=\"/index.php?id=".$idcdelete."&idcomp=".$idcomp."&compchar=".$compchar."&abbreviation=".$abbreviation."\">
<img src=\"http://www.pianoquartet.nl/assets/snippets/nbscripts/images/delete.png\" alt=\"Delete $name\" title=\"Delete $name\" style=\"border:0\"></a></td>";
echo " </tr>";
echo " </tr>";
}
echo " </tbody></table>";
}
//mysql_close($sqlConn);
?>