clindsey
Joined: 01 Sep 2008
Posts: 31
Posted: 2009-08-02 19:19
Back to top
Reply with quote
|
I am trying to create a field that uses the information from that cell and another in my table, and I would appreciate any help I can get. I know I'll have to use mysql concat, but I'm not sure how to create the link from two fields.
Here's what I am looking for. The link would be like http://example.com/field1%20field2. I would like the text in the cell (field2) to be linked.
Does anyone know how to do this? Thanks a bunch.
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2009-08-05 13:29
Back to top
Reply with quote
|
Try something along the lines of
| Code: |
$opts['fdd']['email']['sql|LF'] =
'if(email <> "",
CONCAT("<a href=\"mailto:", email,
"?subject=Hello&body=Merry%20Christmas,
Bill\">",
yourOtherColumn,
"</a>"),
"")'; |
|
clindsey
Joined: 01 Sep 2008
Posts: 31
Posted: 2009-12-16 04:21
Back to top
Reply with quote
|
Doug,
I've almost got this working, but the second (and third) fields aren't being pulled from the database. My columns are number and subject, and the link includes both the subject and the number, and I need the link text to be the number. So:
| Code: |
$opts['fdd']['number'] = array(
'escape' => false,
'name' => 'Number',
);
$opts['fdd']['number']['sql|VLF'] =
'if(number <> "",
CONCAT("<a href=\"http://bulletin.uga.edu/Link.aspx?cid=,
subject,
%20",
number,
"\" target=\"_blank\">,
number,
</a>"),
"")'; |
The subject and the second number aren't pulling from the database. The link should ultimately be
| Code: |
| <a href="http://bulletin.uga.edu/Link.aspx?subject%20number" target="_blank">number</a> |
Any ideas?
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2009-12-16 04:55
Back to top
Reply with quote
|
Quoting with " should be more like this;
| Code: |
| CONCAT("<a href=\"http://bulletin.uga.edu/Link.aspx?cid=", subject, "%20", number, "\" target=\"_blank\">", number, "</a>"), |
|
clindsey
Joined: 01 Sep 2008
Posts: 31
Posted: 2009-12-16 05:42
Back to top
Reply with quote
|
Doug,
That's exactly what I was looking for and it works great. Thank you so much.
This is amazing, that phpMyEdit can do this much.
Did you happen to see my question about links to records?
http://opensource.platon.sk/forum/projects/viewtopic.php?t=828533
Thanks again!
Chris
|
clindsey
Joined: 01 Sep 2008
Posts: 31
Posted: 2010-01-07 20:11
Back to top
Reply with quote
|
Doug,
I recently discovered an issue with the code you suggested. While using the sql query to make the links, I can no longer filter using the 'number' column.
The code I'm using is:
| Code: |
$opts['fdd']['number'] = array(
'select' => 'D',
'escape' => false,
'name' => 'Number',
);
$opts['fdd']['number']['sql|VLF'] =
'if(number <> "",
CONCAT("<a href=\"http://ugakey.com/description.php#bulletin.uga.edu/Link.aspx?cid=", subject, "%20", number, "\" target=\"_blank\">", number, "</a>"),
"")'; |
When I select a value from the drop down and hit 'Filter', no rows are shown on the next page.
If I take out that sql query, bam, I can filter again. Put it back in, and the filtering by 'number' returns no results.
Any idea what the issue is? I feel like I am missing a simple option here, but I've changed quite a bit and can't manage to get this to work.
Thanks for your help.
|
clindsey
Joined: 01 Sep 2008
Posts: 31
Posted: 2010-01-08 04:59
Back to top
Reply with quote
|
Anyone have a clue?
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2010-01-09 15:41
Back to top
Reply with quote
|
Perhaps the link can be incorporated in a new virtual (dummy) field which is displayed in addition to the original field array. A new field similar in structure to this:
| Code: |
$opts['fdd']['dummy1'] = array (
'input' => 'R',
'name' => 'Whois',
'sql' => 'CONCAT("<a href=\"http://whois.domaintools.com/", domain, "\" target=\"_blank\">whois</a>")',
'options' => 'VFL',
'escape' => false,
'sort' => true
); |
|
clindsey
Joined: 01 Sep 2008
Posts: 31
Posted: 2010-01-10 05:46
Back to top
Reply with quote
|
Doug,
Thanks for getting back to me. I've tried to use this code two different ways, but neither is showing the records on the filter with the sql field.
| Code: |
$opts['fdd']['number'] = array(
'select' => 'D',
'escape' => false,
'name' => 'Number',
'sort' => true
);
$opts['fdd']['number']['sql|VLF'] =
'if(number <> "",
CONCAT("<a href=\"http://ugakey.com/description.php#bulletin.uga.edu/Link.aspx?cid=", subject, "%20", number, "\" target=\"_blank\">", number, "</a>"),
"")';
$opts['fdd']['number'] = array (
'input' => 'R',
'select' => 'D',
'name' => 'Number',
'sql' => 'if(number <> "",
CONCAT("<a href=\"http://ugakey.com/description.php#bulletin.uga.edu/Link.aspx?cid=", subject, "%20", number, "\" target=\"_blank\">", number, "</a>"),
"")',
'options' => 'VFL',
'escape' => false,
'sort' => true
);
|
And:
| Code: |
$opts['fdd']['number'] = array(
'select' => 'D',
'escape' => false,
'name' => 'Number',
'sort' => true
);
$opts['fdd']['number'] = array (
'input' => 'R',
'select' => 'D',
'name' => 'Number',
'sql' => 'if(number <> "",
CONCAT("<a href=\"http://ugakey.com/description.php#bulletin.uga.edu/Link.aspx?cid=", subject, "%20", number, "\" target=\"_blank\">", number, "</a>"),
"")',
'options' => 'VFL',
'escape' => false,
'sort' => true
);
|
Can you spot any error? I really appreciate your help.
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2010-01-10 05:56
Back to top
Reply with quote
|
| Code: |
// recreate a standard / default `number` field here
// create dummy / virtual field approximately like this
$opts['fdd']['dummy1'] = array (
'input' => 'R',
'name' => 'Whois',
'sql' => 'if(number <> "", CONCAT("<a href=\"http://ugakey.com/description.php#bulletin.uga.edu/Link.aspx?cid=", subject, "%20", number, "\" target=\"_blank\">", number, "</a>"), "")',
'options' => 'VFL',
'escape' => false,
'sort' => true
); |
|
clindsey
Joined: 01 Sep 2008
Posts: 31
Posted: 2010-01-10 06:10
Back to top
Reply with quote
|
Doug,
I'm trying this and it still isn't letting me filter with that field. Just to make sure we are talking about the same thing, originally, my non-filtering code was this:
| Code: |
$opts['fdd']['number'] = array(
'select' => 'D',
'escape' => false,
'name' => 'Number',
'sort' => true
);
$opts['fdd']['number']['sql|VLF'] =
'if(number <> "",
CONCAT("<a href=\"http://ugakey.com/description.php#bulletin.uga.edu/Link.aspx?cid=", subject, "%20", number, "\" target=\"_blank\">", number, "</a>"),
"")';
|
The code you've put here that I've tried and doesn't filter properly is this:
| Code: |
$opts['fdd']['number'] = array(
'select' => 'D',
'escape' => false,
'name' => 'Number',
'sort' => true
);
$opts['fdd']['number']['sql|VLF'] =
'if(number <> "",
CONCAT("<a href=\"http://ugakey.com/description.php#bulletin.uga.edu/Link.aspx?cid=", subject, "%20", number, "\" target=\"_blank\">", number, "</a>"),
"")';
$opts['fdd']['number'] = array (
'input' => 'R',
'select' => 'D',
'name' => 'Number',
'sql' => 'if(number <> "", CONCAT("<a href=\"http://ugakey.com/description.php#bulletin.uga.edu/Link.aspx?cid=", subject, "%20", number, "\" target=\"_blank\">", number, "</a>"), "")',
'options' => 'VFL',
'escape' => false,
'sort' => true
);
|
Thanks again for your continued help.
|
|
Post new topic
Reply to topic
|
|