inbrunst
Založený: 14.04.2009
Príspevky: 8
Zaslal: 2009-04-14 13:57
Návrat hore
Odpovedať s citátom
|
Hi everybody,
I tried to understand the documentation but simply didn´t understand it. I searched the board, but didn´t find the solution...
My problem:
I want to build a form to update/edit userdata. These are stored in two different tables of the same database ("community").
In table "tb_users" is a field "email" which I need to edit.
The other table is called "tb_profile". I have a form which allows me to edit contents of the table "tb_profile", now I need to add possibility to edit the email-field from "tb_users".
I suppose the answer could be found here:
http://opensource.platon.sk/projects/doc.php/phpMyEdit/html/configuration.input-restrictions.html
Sorry, I don´t understand it. Could anybody help a newbie?
Thanks a lot!
|
inbrunst
Založený: 14.04.2009
Príspevky: 8
Zaslal: 2009-04-14 20:06
Návrat hore
Odpovedať s citátom
|
I tried the following (and much more):
| Kód: |
$opts['fdd']['email'] = array(
'default' => '',
'input' => '',
'maxlen' => 30,
'name' => 'Email',
'options' => 'ACPVDFL',
'required' => false,
'select' => '',
'size|ACP' => 30,
'sort' => true,
'values' => array(
'table' => 'tb_users',
'column' => 'email',
'description' => array(
'columns' => array('email')
)
)
);
|
And here is what I got:
| Kód: |
MySQL error 1054
Unknown column 'PMEtable0.email' in 'on clause'
phpMyEdit error: invalid SQL query
SELECT `PMEtable0`.`id` AS `qf0`,`PMEtable0`.`cb_addressid` AS `qf2`,`PMEtable0`.`firstname` AS `qf4`,`PMEtable0`.`lastname` AS `qf5`,`PMEtable0`.`lastupdatedate` AS `qf6` FROM `tb_profile` AS `PMEtable0` LEFT OUTER JOIN `tb_users` AS `PMEjoin1` ON (`PMEjoin1`.`email` = `PMEtable0`.`email`) ORDER BY `PMEtable0`.`user_id` LIMIT 0, 25
|
I really don´t know what I´m doing...
PLEASE HELP! I´m totally lost here.[/code]
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-04-15 13:27
Návrat hore
Odpovedať s citátom
|
You can display a field from another table in List mode, but you won't be able to edit the "remote" field. Using phpMyAdmin, export the schema (without the data) from tb_users and tb_profile and post it here so that someone can see the field definitions.
|
inbrunst
Založený: 14.04.2009
Príspevky: 8
Zaslal: 2009-04-15 14:12
Návrat hore
Odpovedať s citátom
|
Hi!
I changed some names: "tb_users" is jos_users, tb_profile now is "jos_comprofiler"
MySQL-dumps:
| Kód: |
-- phpMyAdmin SQL Dump
-- version 2.8.2.4
-- http://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Erstellungszeit: 15. April 2009 um 15:04
-- Server Version: 5.0.51
-- PHP-Version: 5.2.6
--
-- Datenbank: `community`
--
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `jos_users`
--
CREATE TABLE `jos_users` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
`username` varchar(150) NOT NULL default '',
`email` varchar(100) NOT NULL default '',
`password` varchar(100) NOT NULL default '',
`usertype` varchar(25) NOT NULL default '',
`block` tinyint(4) NOT NULL default '0',
`sendEmail` tinyint(4) default '0',
`gid` tinyint(3) unsigned NOT NULL default '1',
`registerDate` datetime NOT NULL default '0000-00-00 00:00:00',
`lastvisitDate` datetime NOT NULL default '0000-00-00 00:00:00',
`activation` varchar(100) NOT NULL default '',
`params` text NOT NULL,
PRIMARY KEY (`id`),
KEY `usertype` (`usertype`),
KEY `idx_name` (`name`),
KEY `gid_block` (`gid`,`block`),
KEY `username` (`username`),
KEY `email` (`email`)
) ENGINE=MyISAM AUTO_INCREMENT=75539 DEFAULT CHARSET=utf8 AUTO_INCREMENT=75539 ;
|
and
| Kód: |
-- phpMyAdmin SQL Dump
-- version 2.8.2.4
-- http://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Erstellungszeit: 15. April 2009 um 15:03
-- Server Version: 5.0.51
-- PHP-Version: 5.2.6
--
-- Datenbank: `community`
--
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `jos_comprofiler`
--
CREATE TABLE `jos_comprofiler` (
`id` int(11) NOT NULL default '0',
`user_id` int(11) NOT NULL default '0',
`firstname` varchar(100) default NULL,
`middlename` varchar(100) default NULL,
`lastname` varchar(100) default NULL,
`hits` int(11) NOT NULL default '0',
`message_last_sent` datetime NOT NULL default '0000-00-00 00:00:00',
`message_number_sent` int(11) NOT NULL default '0',
`avatar` varchar(255) default NULL,
`avatarapproved` tinyint(4) NOT NULL default '1',
`approved` tinyint(4) NOT NULL default '1',
`confirmed` tinyint(4) NOT NULL default '1',
`lastupdatedate` datetime NOT NULL default '0000-00-00 00:00:00',
`registeripaddr` varchar(50) NOT NULL default '',
`cbactivation` varchar(50) NOT NULL default '',
`banned` tinyint(4) NOT NULL default '0',
`banneddate` datetime default NULL,
`unbanneddate` datetime default NULL,
`bannedby` int(11) default NULL,
`unbannedby` int(11) default NULL,
`bannedreason` mediumtext,
`acceptedterms` tinyint(1) NOT NULL default '0',
`website` varchar(255) default NULL,
`company` varchar(255) default NULL,
`cb_countrylist` varchar(255) default NULL,
`cb_jobfunction` varchar(255) default NULL,
`cb_marketsegment` varchar(255) default NULL,
`cb_division` varchar(255) default NULL,
`cb_newsletter` varchar(255) default NULL,
`cb_notices` varchar(255) default NULL,
`cb_ecemagazine` varchar(255) default NULL,
`cb_boardsmagazine` varchar(255) default NULL,
`cb_street1` varchar(255) default NULL,
`cb_street2` varchar(255) default NULL,
`cb_zip` varchar(255) default NULL,
`cb_city1` varchar(255) default NULL,
`cb_city2` varchar(255) default NULL,
`cb_unsubscribe` mediumtext NOT NULL,
`cb_interestchips` tinyint(3) unsigned default NULL,
`cb_interesttools` tinyint(3) unsigned default NULL,
`cb_interestboards` tinyint(3) unsigned default NULL,
`cb_phone` varchar(255) default NULL,
`cb_fax` varchar(255) default NULL,
`cb_addressid` int(11) default NULL,
`cb_source1` varchar(255) default NULL,
`cb_source2` varchar(255) default NULL,
`cb_edmstatus` mediumtext,
`cb_emailstatus` varchar(255) default NULL,
`cb_datumemailstatus` date default NULL,
`cb_adressstatus` varchar(255) default NULL,
`cb_datumadressstatus` date default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user_id` (`user_id`),
KEY `apprconfbanid` (`approved`,`confirmed`,`banned`,`id`),
KEY `avatappr_apr_conf_ban_avatar` (`avatarapproved`,`approved`,`confirmed`,`banned`,`avatar`),
KEY `lastupdatedate` (`lastupdatedate`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
Is there any way to achieve what I need to do?
Thank you for your help!
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-04-15 15:07
Návrat hore
Odpovedať s citátom
|
The following should at least let you display the email address from the jos_comprofiler form.
| Kód: |
$opts['fdd']['user_id'] = array(
'default' => '',
'input' => 'R',
'name' => 'Test',
'options' => '',
'select' => 'T',
'sort' => true,
'values' => array(
'table' => 'jos_users',
'column' => 'id',
'description' => array(
'columns' => array('0' => 'email')
)
)
);
$opts['fdd']['virtual_field'] = array(
'input' => 'VR',
'name' => 'Virtual Field',
'options' => 'LFV',
'escape' => false,
'sql|LF' => 'if(email <> "", CONCAT("<a href=\"mailto:", email, "?subject=Hello\">", email, "</a>"), "")'
);
/*
// display after email link: [user_id]
$opts['fdd']['virtual_field'] = array(
'input' => 'VR',
'name' => 'Virtual Field',
'options' => 'LFV',
'escape' => false,
'sql|LF' => 'if(email <> "", CONCAT("<a href=\"mailto:", email, "?subject=Hello\">", email, "</a> [", user_id, "]"), "")'
);
*/ |
|
inbrunst
Založený: 14.04.2009
Príspevky: 8
Zaslal: 2009-04-15 15:19
Návrat hore
Odpovedať s citátom
|
This is working. Thanks!
Do you have an idea how I could edit this? What about creating a field "email_helper" in "jos_comprofiler" and linking it to the field "email" in jos_users (would this be possible by using triggers?)?
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-04-15 15:31
Návrat hore
Odpovedať s citátom
|
| inbrunst Napísal: |
| Do you have an idea how I could edit this? |
You can't edit the email address from the jos_comprofiler form.
|
inbrunst
Založený: 14.04.2009
Príspevky: 8
Zaslal: 2009-04-15 15:44
Návrat hore
Odpovedať s citátom
|
| inbrunst Napísal: |
| What about creating a field "email_helper" in "jos_comprofiler" and linking it to the field "email" in jos_users (would this be possible by using triggers?)? |
Using MySQL-functionality...?
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-04-15 18:00
Návrat hore
Odpovedať s citátom
|
With phpMyEdit you can edit one table at a time, and sometimes display a related field from another table.
As far as I know, to edit data in different tables using one form, you need to abandon phpMyEdit and write custom PHP scripts.
|
inbrunst
Založený: 14.04.2009
Príspevky: 8
Zaslal: 2009-04-23 21:15
Návrat hore
Odpovedať s citátom
|
Hi again!
Doug:
Sorry I didn´t reply, I was out of town. You´re a great help!
I´ve got a bizarre problem:
I created a new form (for clean code) and acidentally deleted the old working one.
Now, when I insert your code, the form doesn´t work anymore. There is no warning, just a blank page, when I try to view the source of the generated page there´s nothing. There must be some minor syntax-error, but I can´t find it. Could you have a look at it? Perhaps you can see something...
I don´t get it: it worked and now it doesn´t!
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-04-24 02:36
Návrat hore
Odpovedať s citátom
|
The most common cause of this is when someone uploads language files and their FTP client forces lower case filenames. It dies 'cause it can't find the language files. Turn error_reporting up, or enable track_errors and use $php_errormsg, or (maybe best of all) check your server log for errors.
|
inbrunst
Založený: 14.04.2009
Príspevky: 8
Zaslal: 2009-04-26 16:08
Návrat hore
Odpovedať s citátom
|
This can´t be the problem. If I take out the code you´ve posted the form works. If I paste it again, I´m getting the blank page... There must be a simple syntax error which kills the whole script. I´m getting crazy with that!
|
|
Odoslať novú tému
Odpovedať na tému
|
|