Hi VGR,
The problem:
The flash has buttons that trigger the functions: volgende(), vorige(), eerste() and laatste(), (Dutch for next, previous, first, last)
If one of the fields in a retrieved record contains an extended Ascii character (see my initial posting) the PHP class stops functioning.
For example if the name-field contains the name Aïda or René then the problem occurs, because of the the "ï" and "é"
The class:
<?php
/**********
Fields in the database:
ID
user
password
userlevel
voornaam
achternaam
initialen
straat
postcode
plaats
telefoon
email
haar_naam
zijn_profiel
haar_profiel
burgerlijke_staat
beroep
branche
titel
fax_prive
mobiel
adres_zakelijk
telefoon_zakelijk
fax_zakelijk
email_zakelijk
foto_zijn
foto_haar
***********/
/*************************
Zaken die veranderd moeten worden voor een andere server/directory:
-> In de as file: setDefaultGatewayUrl
-> database gegevens in de PHP classfile, user etc
-> eventueel het aanroepen van de scripts in de flash zelf
-> flash opnieuw compileren
**************************
class facetoface_class
{
var $story = "TEST";
/* LOCAL: */
var $table_name = "leden";
var $Host = "localhost"; // Hostname of our MySQL server.
var $Database = "audio5"; // Logical database name on that server.
var $User = "root"; // User und Password for login.
var $Password = "";
/* REMOTE
var $table_name = "leden";
var $Host = "*******"; // Hostname of our MySQL server.
var $Database = "audio5"; // Logical database name on that server.
var $User = "audio5"; // User und Password for login.
var $Password = "******";
*/
var $Query_String = "SELECT ID FROM leden";
var $connection; // Result of mysql_connect().
var $result; // Result of most recent mysql_query().
var $Record = array(); // current mysql_fetch_array()-result
var $Row; // current row number.
var $msg = "";
var $Errno = 0; // error state of query...
var $Error = "";
var $num = 10;
var $IDnummer;
// variabelen database fields
var $ID = 0;
var $voornaam = "";
var $achternaam = "";
var $initialen = "";
var $straat = "";
var $postcode = "";
var $plaats = "";
var $telefoon = "";
var $email = "";
var $haar_naam = "";
var $zijn_profiel = "";
var $haar_profiel = "";
var $burgerlijke_staat = "";
var $beroep = "";
var $branche = "";
var $titel = "";
var $fax_prive = "";
var $mobiel = "";
var $adres_zakelijk = "";
var $telefoon_zakelijk = "";
var $fax_zakelijk = "";
var $email_zakelijk = "";
var $foto_zijn = "dummy.jpg";
var $foto_haar = "dummy.jpg";
// samenstellen naam linksboven
var $naam = "";
var $rowarray = array();
var $counter = 0;
var $rowpointer = 0;
// het bewerkte zakelijk adres
var $zakelijk_adres = ""; // CrLf vervangen
var $aantal = 0; //aantal records
var $CrLf = ""; //
var $portret_dir = "portretten/"; // lokatie van de portretten
var $dummy = "portretten/dummy.jpg"; // vervangend plaatje als portret ontbreekt
function Foo() {
$this->init();
}
function init() {
echo "GELUKT!!!\n";
}
function recordnummer($n){
$this->nummer = $n;
}
function initDb(){
//$this->rowpointer = 7;
$this->connect();
$this->result = mysql_query($this->Query_S
$this->Row = 0;
while ( $this->Record = mysql_fetch_array($this->r
$this->rowarray[$this->Row
$this->Row += 1;
}
$this->aantal = $this->num_rows();
// mysql_close($this->connect
$this->showRecord($this->I
$this->rowpointer = $this->row_num()+1;
}
function connect() {
if ( 0 == $this->connection ) {
$this->connection=mysql_co
if (!$this->connection) {
$this->msg="Link-ID == false, connect failed";
$this->halt();
}
if (!mysql_query(sprintf("use
$this->msg="cannot use database ".$this->Database;
$this->halt();
}
}
}
/*************************
function showRecord($i) {
$this->Query_String = "SELECT * FROM leden where ID = ".$i;
$this->connect();
$this->result = mysql_query($this->Query_S
$this->Record = mysql_fetch_array($this->r
$this->ID = $this->Record['ID'];
$this->voornaam = $this->Record['voornaam'];
$this->achternaam = $this->Record['achternaam'
$this->initialen = $this->Record['initialen']
$this->straat = $this->Record['straat'];
$this->postcode = $this->Record['postcode'];
$this->plaats = $this->Record['plaats'];
$this->telefoon = $this->Record['telefoon'];
$this->email = $this->Record['email'];
$this->haar_naam = $this->Record['haar_naam']
$this->zijn_profiel = $this->Record['zijn_profie
$this->haar_profiel = $this->Record['haar_profie
$this->burgerlijke_staat = $this->Record['burgerlijke
$this->beroep = $this->Record['beroep'];
$this->branche = $this->Record['branche'];
$this->titel = $this->Record['titel'];
$this->fax_prive = $this->Record['fax_prive']
$this->mobiel = $this->Record['mobiel'];
$this->adres_zakelijk = $this->Record['adres_zakel
$this->telefoon_zakelijk = $this->Record['telefoon_za
$this->fax_zakelijk = $this->Record['fax_zakelij
$this->email_zakelijk = $this->Record['email_zakel
mysql_close($this->connect
$this->naam = $this->achternaam.", ";
$this->naam .= $this->initialen;
// CrLf in adresvervangen door "\n"
$this->CrLf .= chr(13);
$this->CrLf .= chr(10);
$this->zakelijk_adres = str_replace($this->CrLf, "\n", $this->adres_zakelijk);
// naam en lokatie van de plaatjes
$this->portret_base = $this->portret_dir;
$this->portret_base .= "img".$this->ID; // eerste deel van plaatjesnaam
$this->foto_zijn = $this->portret_base."a.jpg
if (!is_file ( $this->foto_zijn )){
$this->foto_zijn = $this->dummy;
}
$this->foto_haar = $this->portret_base."b.jpg
if (!is_file ( $this->foto_haar )){
$this->foto_haar = $this->dummy;
}
// Just for testing::
/*
echo "local variabe IDnummer = ".$this->IDnummer;
echo "\nTEST2\n".$this->portret
//echo "aantal records: ".count($this->rowarray)."
echo "Aantal records: ".$this->aantal."\n";
echo "row number : ";
echo $this->row_num()+1;
echo "\nID = ".$this->ID;
echo "\n ID behorender bij ".$this->IDnummer." : ".$this->rowarray[$this->r
*/
}
function showarray(){ //for testing
for ($i=0;$i<count($this->rowa
echo $i;
echo " ID: ";
echo $this->rowarray[$i];
echo "\n";
}
}
function row_num(){ // row number ophalen
for ($rn=0;$rn<count($this->ro
if ($this->rowarray[$rn] == $this->ID){
$myRow = $rn;
return $myRow;
break;
}
}
// return $myRow;
}
function seek($pos) {
$status = mysql_data_seek($this->res
if ($status)
$this->Row = $pos;
return;
}
function num_rows() {
return mysql_num_rows($this->resu
}
function num_fields() {
return mysql_num_fields($this->re
}
function f($Name) {
return $this->Record[$Name];
}
function p($Name) {
print $this->Record[$Name];
}
function affected_rows() {
return @mysql_affected_rows($this
}
function volgende() { //next record
if ($this->rowpointer < $this->aantal){
$this->rowpointer += 1;
$this->IDnummer = $this->rowarray[$this->row
echo"Volgende rownummer = $this->rowpointer\n";
$this->showRecord($this->I
}
}
function vorige() {//previous record
if ($this->rowpointer > 1){
$this->rowpointer -= 1;
$this->IDnummer = $this->rowarray[$this->row
$this->showRecord($this->I
}
}
function eerste() {//first record
//echo "DE EERSTE\n";
$this->IDnummer = $this->rowarray[0];
$this->showRecord($this->I
$this->rowpointer =1;
}
function laatste() {//last record
//echo "LAATSTE\n";
$this->IDnummer = $this->rowarray[$this->aan
$this->showRecord($this->I
$this->rowpointer =$this->aantal;
}
}
?>
Main Topics
Browse All Topics





by: VGRPosted on 2003-10-05 at 00:04:25ID: 9493746
could you please post the class, and describe fully the problem ?