| Index
» Projects
» phpMyEdit
» Forum
» How to manipulate two field value strings? |
 |
devkbsc
Joined: 30 Dec 2014
Posts: 7
Posted: 2015-02-18 14:39
Back to top
Reply with quote
|
Hello,
I have two fields in my form. The first one is
- firstname : Arnold
- lastname : Schwarzenegger
Donc the third field called "username" has to be automatically store in the datebase just by using this formula
- first letter of my "firstname" continued by the lastname
Result
username : SARNOLD
how to manipluate in the way of phpmyedit? any suggestions please?
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2015-02-18 15:45
Back to top
Reply with quote
|
Search the forum for examples using CONCAT and try using it with MySQL LEFT. Though the logic for using non unique usernames may cause you problems later.
|
devkbsc
Joined: 30 Dec 2014
Posts: 7
Posted: 2015-02-24 11:02
Back to top
Reply with quote
|
Hello,
Here i have tried just what you have told. But i have got a a blank page.
this is my source code
/*$opts['fdd']['username'] = array(
'name' => "Nom d'utilisateur",
'select' => 'T',
'input' => 'R',
'maxlen' => 25,
'sort' => true
);*/
$opts['fdd']['username'] = array (
'name' => "Nom d'utilisateur",
'sql' => 'CONCAT(LEFT(prenom)," ",nom)',
'options' => 'VDL',
'escape' => false,
'sort' => true
);
the first generated source is commandated. I have executed the program. i have got the following error
MySQL error 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')," ",last_name) AS `qf4`,`PMEtable0`.`email` AS `qf5`,`PMEtable0`.`fonction` AS' at line 1
if i merged all those propertied together as follow
$opts['fdd']['username'] = array (
'name' => "Nom d'utilisateur",
'sql' => 'CONCAT(LEFT(prenom)," ",nom)',
'options' => 'VDL',
'escape' => false,
'sort' => true
'select' => 'T',
'input' => 'R',
'maxlen' => 25,
);
i have got a blank page finally. Can please help to find my error?
|
|
Post new topic
Reply to topic
|
|
|
|