| Index
» Projekty
» phpMyEdit
» Fórum
» Help with triggers |
 |
fefe64
Založený: 11.12.2006
Príspevky: 13
Zaslal: 2007-02-02 13:42
Návrat hore
Odpovedať s citátom
|
Hello i need help!
I would like to use the trigger:
i have a table
PERSON (PE_id, PE_firstname,PE_lastname, PE_file_name)
i would like when i insert a person to enter the person
firstname and lastname, and with a triggers to create the PE_film_name
automatically.
The PE_file_name is the same of the PE_firstname and lastname
without exotic caracters!
For that i use this code:
////
($str==> firstname and last name)
$str = strtr($str, "ÀÁÂÃÄÅàáâãäåÇçÒÓÔÕÖØòóôõöøÈÉÊËèéêëÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ", "AAAAAAaaaaaaCcOOOOOOooooooEEEEeeeeIIIIiiiiUUUUuuuuyNn");
$str = preg_replace('/[^a-z0-9_-\s]/', '', strtolower($str));
$str = preg_replace('/[\s]+/', ' ', trim($str));
$res = str_replace(' ', '-', $str);
Please help me with an example.
I don't understand the triggers, how do i send and receive the data to a triggers!
Thanks
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2007-02-09 12:15
Návrat hore
Odpovedať s citátom
|
you are looking for before insert/update trigger. it will be something like
| Kód: |
<?php
$str = $newvals['first_name'];
// your $str stuff here
$newvals['fill_name'] = $str;
return true;
|
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|