Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Piatok, 6. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Need to add an IF statement to virtual field

phpMyEdit Configuration     Need to add an IF statement to virtual field
Odoslať novú tému   Odpovedať na tému   Choď na stránku 1, 2  Ďalší  
 
kally     Založený: 05.01.2005   Príspevky: 14  
Príspevok Zaslal: 2010-05-02 04:41
Návrat hore  Odpovedať s citátom     

I have a table with information about uploaded images:

id smallint(4),
category varchar(30),
subcategory varchar(30),
img_type varchar(15),
filename varchar(40),
image varchar(75),
width varchar(6),
height varchar(6)

I have another table that has a field in common (PMEtable0.filename = $itemsTable.image) and another field called display that has either a yes or no value.

In order to see the "display" column of the second table I have the following code:

$opts['fdd']['virtual4'] = array(
'name' => 'Set to Display?',
'input' => 'R',
'sort' => true,
'sql' => "(SELECT a.display FROM ".$itemsTable." as a, ".$imagesTable." as b WHERE b.id LIKE PMEtable0.id AND a.image = b.filename )"
);

This works fine. But, not all of the images are listed in both tables. So, while most query results will return a yes or no, if there is no result, I get a blank field. Instead of a blank field I would like to display text, maybe something like "Not in Database".

I have tried to do this using sqlw but am not coming up with something that works.

I tried:
'sqlw' => 'IF($val_qas = "", "Not in Database", $val_qas)'

But get nothing. Am I misunderstanding the way this can be used or is my syntax wrong?
Do you think I need to use a trigger or php? Since this is a virtual field I wasn't sure what would work or what to do.

Thank you for any advice you can give.

 
Malino     Založený: 23.02.2010   Príspevky: 7  
Príspevok Zaslal: 2010-05-26 11:02
Návrat hore  Odpovedať s citátom     

Try this:
Kód:
SELECT ifnull(a.display, "na database entry")
FROM ".$itemTable." AS a
LEFT JOIN ".$imageTable." AS b ON a.image = b.filename
WHERE b.id LIKE PMEtable0.id


 
danverseak2     Založený: 07.09.2022   Príspevky: 72  
Príspevok Zaslal: 2023-01-06 02:41
Návrat hore  Odpovedať s citátom     

Our diagnostics computer will help us quickly identify the problem and get you back on your way.

Yuba City Mobile Truck Repair

 
seoexpert     Založený: 13.06.2021   Príspevky: 1571  
Príspevok Zaslal: 2023-05-14 14:34
Návrat hore  Odpovedať s citátom     

With so many books and articles coming up to give gateway to make-money-online field and confusing reader even more on the actual way of earning money, Mix Parlay

 
seoexpert     Založený: 13.06.2021   Príspevky: 1571  
Príspevok Zaslal: 2023-05-17 11:27
Návrat hore  Odpovedať s citátom     

Took me time to understand all of the comments, but I seriously enjoyed the write-up. It proved being really helpful to me and Im positive to all of the commenters right here! Its constantly nice when you can not only be informed, but also entertained! I am certain you had enjoyable writing this write-up. One Bernam floor plan

 
seoexpert     Založený: 13.06.2021   Príspevky: 1571  
Príspevok Zaslal: 2023-05-18 11:38
Návrat hore  Odpovedať s citátom     

There's no doubt i would fully rate it after i read what is the idea about this article. You did a nice job.. Canning Hill Piers floor plan

 
kenwood     Založený: 15.03.2022   Príspevky: 3669  
Príspevok Zaslal: 2023-05-18 13:31
Návrat hore  Odpovedať s citátom     

Choosing the right truck mattress can help drivers avoid back pain and other discomforts associated with poor sleep quality, as well as improve overall health and well-being. best truck mattress

 
Microservices01     Založený: 21.05.2023   Príspevky: 1  
Príspevok Zaslal: 2023-05-21 18:41
Návrat hore  Odpovedať s citátom     

Explore methodologies, tools, and best practices for database scaling in microservices to improve performance and effectiveness. Learn how cloud-based options like AWS ECR and GCP managed databases may speed up your database scaling journey by using containerization technology and DevOps techniques.

 
kenwood     Založený: 15.03.2022   Príspevky: 3669  
Príspevok Zaslal: 2023-05-29 16:38
Návrat hore  Odpovedať s citátom     

The appliances have a compact and space-saving design, making them ideal for small laundry areas or apartments. best LG washer and dryer

 
falseboink     Založený: 11.09.2023   Príspevky: 1  
Príspevok Zaslal: 2023-09-11 08:34
Návrat hore  Odpovedať s citátom     

You begin snake io as a small snake, and you must consume little balls strewn over the area to grow to be the largest snake there. It won't be simple to survive though because you'll have to stay away from other snakes who share your objective.

 
shamshadali     Založený: 04.12.2023   Príspevky: 25  
Príspevok Zaslal: 2023-12-15 13:22
Návrat hore  Odpovedať s citátom     

Sure, to add an IF statement to a virtual field, use the syntax: IF(condition, value_if_true, value_if_false). This enables the field to dynamically display different values based on the specified condition, enhancing data presentation and functionality. coin laundry mat

 
abdulmoeez     Založený: 23.09.2023   Príspevky: 1145  
Príspevok Zaslal: 2023-12-16 08:38
Návrat hore  Odpovedať s citátom     

87 Marketing crafts advertising that resonates. Our experts understand your audience and strategically position your brand to captivate attention, ensuring your message is heard loud and clear in the digital realm. SEO

 
shamshadali     Založený: 04.12.2023   Príspevky: 25  
Príspevok Zaslal: 2024-01-14 14:23
Návrat hore  Odpovedať s citátom     

To enhance functionality in your system, consider incorporating an IF statement into the virtual field. This conditional statement will allow dynamic responses based on specified conditions, optimizing the virtual field's performance and ensuring a more robust and adaptable system. laundry near me

 
deebeeess0777     Založený: 24.08.2023   Príspevky: 229  
Príspevok Zaslal: 2024-01-15 07:56
Návrat hore  Odpovedať s citátom     

I found this post very interesting and informative. Thank you for sharing your special thoughts with us. My site: betting apps boxing

 
deebeeess0777     Založený: 24.08.2023   Príspevky: 229  
Príspevok Zaslal: 2024-01-15 07:57
Návrat hore  Odpovedať s citátom     

We have a site for sports games. You must be interested. betting apps boxing

 
Odoslať novú tému   Odpovedať na tému   Choď na stránku 1, 2  Ďalší  

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov