Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Check for any value in a field.

Quote Reply
Check for any value in a field.
Heya all,

I'm hacking a global and I'm trying check a field to see if there's ANY value in there. How do I do that?

Example: I want to check if the person has uploaded and image. Obviously the image names and formats may differ.

Code:
$sth = $search_db->select ( { isValidated => 'Yes', Image => '???' });

Thanks in advance.

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Check for any value in a field. In reply to
Hi,

Something like this should work :)

$sth = $search_db->select ( GT::SQL::Condition->new('isValidated','=','Yes','Image','NOT','NULL') );

Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Check for any value in a field. In reply to
Nope that gives me:

Quote:
OK
The server encountered an internal error or misconfiguration and was unable to complete your request.
Wink

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Check for any value in a field. In reply to
Mmm.. is this in a global, or a script? If in a script, you may need to include GT::SQL::Condition;

use GT::SQL::Condition;

..alongside the other "use" statements should be fine.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [sangiro] Check for any value in a field. In reply to
   
$sth = $search_db->select ( GT::SQL::Condition->new('isValidated','=','Yes','Image','IS NOT',\'NULL') );