| Index
» Projects
» phpMyEdit
» Forum
» How to find value from another field |
 |
kdlucas
Joined: 15 Oct 2006
Posts: 3
Posted: 2009-05-18 21:07
Back to top
Reply with quote
|
I have a database that uses phpMyEdit to create URL's to find the source code to file names. The URL link prefix is dependent on the value of another field.
I have already defined a field:
$opts['fdd']['testset']
and another one:
$opts['fdd']['sourceurl']
So, I wanted to stick a case statement to determine the value of URL, something like this:
switch ($opts['fdd']['testset']['value']){
Case 'Accept':
$opts['fdd']['sourceurl']['URL'] = 'http://url1/$value;
break;
Case 'LTP':
$opts['fdd']['sourceurl']['URL'] = 'http://url2/$value;
break;
}
However, I noticed that $opts['fdd']['testset']['value'] is not set. How do I get the value of a the field testset?
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2009-05-19 14:51
Back to top
Reply with quote
|
To locate some examples which might be useful, use the forum's Search box to search for the MySQL function "CONCAT".
|
kdlucas
Joined: 15 Oct 2006
Posts: 3
Posted: 2009-05-20 00:40
Back to top
Reply with quote
|
Ok, just to help anyone else who might be wondering about this, I used the following with success:
$opts['fdd']['name']['sql|LF'] =
'concat("<a href=\"http://",
CASE testset
WHEN "Accept" THEN "AcceptURL"
WHEN "LTP" THEN "LTPURL"
END,
sourceurl,"\">",name,"</a>")';
This allowed the url to point to a different location depending on the value of the testset field.
|
|
Post new topic
Reply to topic
|
|
|
|