Už som skúsil rôzne kombinácie a stále mám rovnaký výsledok.
PHP 4.x + MySQL 4.x mi ide OK aj program aj phpMyAdmin rovnaký výsledok. Zmena v jednom sa prejaví rovnako v druhom a naopak.
Pripájam "export.sql" a PHP program. Databáza "test" s tabulkou "kontakty". Je tam pár mien s diakritikou. Export je z webu, kde to ide.
Skúste si to naimportovať do XAMPP prostredia, otvoriť v jednom okne PHP program a v druhom okne phpAdmina. Zmeňte meno v PHP programe a pozrite si výsledok v phpAdmine. A naopak.
Ak v oboch prípadoch bude rovnaký výsledok pre znaky " ľ č ť ď " tak by som rád vedel ako to nastaviť na strane XAMPP prostredia!!!!!
SQL SCRIPT
========
-- phpMyAdmin SQL Dump
-- version 2.7.0-pl2
--
http://www.phpmyadmin.net
--
-- Hostiteľ: localhost
-- Vygenerované:: 29.Nov, 2006 - 23:03
-- Verzia serveru: 4.0.18
-- Verzia PHP: 4.3.4
--
-- Databáza: `test`
--
-- --------------------------------------------------------
--
-- Štruktúra tabuľky pre tabuľku `kontakty`
--
CREATE TABLE `kontakty` (
`meno` varchar(20) NOT NULL default '',
`priezv` varchar(20) NOT NULL default ''
) TYPE=MyISAM;
--
-- Sťahujem dáta pre tabuľku `kontakty`
--
INSERT INTO `kontakty` VALUES ('Ľudovít', 'Iľko');
INSERT INTO `kontakty` VALUES ('Vaško', 'Šikovný');
INSERT INTO `kontakty` VALUES ('Anička', 'Čierna');
INSERT INTO `kontakty` VALUES ('Taťjana', 'Ťažká');
INSERT INTO `kontakty` VALUES ('Božena', 'Žhavá');
INSERT INTO `kontakty` VALUES ('Naďa', 'Mäkká');
INSERT INTO `kontakty` VALUES ('Želka', 'Hôrna');
PHP PROGRAM
=========
<?php
//index.php
//--parametre XAMPP servera - login a password si nastav podla seba
$DB_SERVER ="localhost"; // Database Server machine
$DB_LOGIN ="root"; // Database login
$DB_PASSWORD="daniela"; // Database password
$DB ="test"; // Database containing the tables
$HTTP_HOST ="localhost"; // HTTP Host
$DOCROOT ="test"; // Path, where application is installed
$MyAdmin ="phpMyAdmin"; // path to phpMyAdmin
//-----
echo "<html><head><title></title></head>";
echo "<body bgcolor=#ffffff style=\"font-size=12px\">";
$qry="select * from kontakty";
if(!($link = mysql_connect($DB_SERVER,$DB_LOGIN,$DB_PASSWORD)))
echo "Nepodarilo sa pripojit k databaze<br>";
if(!mysql_select_db($DB,$link))
echo mysql_errno().mysql_error()."<br>";
$result=mysql_query($qry);
if(!$result)
echo "Chyba query<br>";
$nr=mysql_num_rows($result);
//-----------------------------------------------------------------------------
function xTH($h)
{
echo "<th>";
echo $h;
echo "</th>";
}
function xTD($d)
{
echo "<td>";
echo $d;
echo "</td>";
}
//-----------------------------------------------------------------------------
// LIST-položky vyberu
echo "<fieldset>";
echo "<legend>QUERY položky</legend>";
$i = 0;
$k = 0;
echo "<table border=1px cellspacing=0 cellpadding=1 style=\"font-size:12px\">";
echo "<tr>";
xTH("blob");
xTH("max_length");
xTH("multiple_key");
xTH("name");
xTH("not_null");
xTH("numeric");
xTH("primary_key");
xTH("table");
xTH("type");
xTH("unique_key");
xTH("unsigned");
xTH("zerofill");
echo "</tr>";
$def=array();
while ($i < mysql_num_fields($result)) {
// echo "Information for column $i:<br />\n";
$meta = mysql_fetch_field($result, $i);
if (!$meta) {
echo "No information available<br />\n";
}
echo "<tr>";
xTD("$meta->blob");
xTD("$meta->max_length");
xTD("$meta->multiple_key");
xTD("$meta->name"); $k++; $def[$k]=$meta->name;
xTD("$meta->not_null");
xTD("$meta->numeric");
xTD("$meta->primary_key");
xTD("$meta->table");
xTD("$meta->type");
xTD("$meta->unique_key");
xTD("$meta->unsigned");
xTD("$meta->zerofill");
echo "</tr>";
$i++;
}
$def[0]=$k;
echo "</table>";
echo "</fieldset>";
echo "<br><br>";
// TABLE data z vyberu
echo "<fieldset>";
echo "<legend>QUERY data</legend>";
echo "<table border=1 cellspacing=0 cellpadding=1 style=\"font-size:12px\">";
echo "<tr>";
xTH("cr");
for($j=1;$j<=$k;$j++) xTH("$def[$j]");
echo "</tr>";
for($i=1;$i<=$nr;$i++)
{
$line=mysql_fetch_assoc($result);
echo "<tr>";
xTD($i);
$s=$line[$def[1]]; if(strlen($s)==0) $s=" "; xTD($s);
$s=$line[$def[2]]; if(strlen($s)==0) $s=" "; xTD($s);
echo "<form action=\"zapis.php\">";
$s1= "<input type=\"text\" name=\"".$def[1]."\" value=\"".$line[$def[1]]."\">";
$s2= "<input type=\"text\" name=\"".$def[2]."\" value=\"".$line[$def[2]]."\">";
$s3= "<input type=\"submit\">";
$s4= "<input type=\"hidden\" name=\"".$def[1]."m\" value=\"".$line[$def[1]]."\">";
$s5= "<input type=\"hidden\" name=\"".$def[2]."p\" value=\"".$line[$def[2]]."\">";
xTH("--->");
xTH($s1);
xTH($s2);
xTH($s3);
xTH($s4);
xTH($s5);
echo "</form>";
echo "</tr>";
}
echo "</table>";
echo "</fieldset>";
// FORM
// -----
mysql_close($link);
echo "<hr><br>";
echo "</body><html>";
?>
A SCRIPT PRE ZAPIS
==============
<?php
// zapis.php
//--parametre XAMPP servera - login a password si nastav podla seba
$DB_SERVER ="localhost"; // Database Server machine
$DB_LOGIN ="root"; // Database login
$DB_PASSWORD="daniela"; // Database password
$DB ="test"; // Database containing the tables
$HTTP_HOST ="localhost"; // HTTP Host
$DOCROOT ="test"; // Path, where application is installed
$MyAdmin ="phpMyAdmin"; // path to phpMyAdmin
//-----
$qry="update kontakty set meno='$meno',priezv='$priezv' where ".
"meno='$menom' and priezv='$priezvp'";
echo $qry."<br>";
if(!($link = mysql_connect($DB_SERVER,$DB_LOGIN,$DB_PASSWORD)))
echo "Nepodarilo sa pripojit k databaze<br>";
if(!mysql_select_db($DB,$link))
echo mysql_errno().mysql_error()."<br>";
$result=mysql_query($qry);
if(!$result)
echo "Chyba query<br>";
echo "<br><a href=\"index.php\">Návrat na formulár</a><br>";
?>