Nick
Posts: 4
|
| Posted: 09/20/2005, 5:17 AM |
|
Using PHP and MySQL.
I'm trying to hide a record form if a user has already saved a job, to stop them saving it again. To do this i've been using a CCDLookup on a before show event, but I can't seem to get it working for multiple WHERE clauses.
Is it possible to do 2 where clauses in a CCDLookup? I've tried to do it using the following method, but keep coming up trumps!
global $saved_jobs;
$db = new clsDBConnection1();
$Result=CCDLookUp("saved_jobs_candidateID", "saved_jobs", ""saved_jobs_jobID = ".CCGetParam("job_id","")."" AND "saved_jobs_candidateID = ".CCGetUserID().""",$db);
if ($Result == CCGetUserID()) {
$saved_jobs->Visible = False;
}
Thanks in advance.
|
 |
 |
Nick
Posts: 4
|
| Posted: 09/20/2005, 7:53 AM |
|
Sorry I forgot to say i'm not getting a parse error when i view the page, but the it's not hiding the record form either!
|
 |
 |
feha
Posts: 712
|
| Posted: 09/20/2005, 1:41 PM |
|
YES
example
$Result=CCDLookUp("COUNT(*) main_id", $table_name, "menu_show=1 AND main_id > 0 AND main_id = ".$db->f("menu_id")." AND menu_level <= ".CCGetGroupID(), $db_sub);
or
$Result=CCDLookUp("main_id", $table_name, "menu_show=1 AND main_id > 0 AND main_id = ".$db->f("menu_id")." AND menu_level <= ".CCGetGroupID(), $db_sub);
Hope this gives you an idea 
_________________
Regards
feha
www.vision.to
feedpixel.com |
 |
 |
Nick
Posts: 4
|
| Posted: 09/21/2005, 3:19 AM |
|
Thanks feha, I changed a few quotes around and it's now working great!
Just in case someone needs a similar example here's the code that I ended up with:
global $saved_jobs;
$db = new clsDBConnection1();
$Result=CCDLookUp("saved_jobs_candidateID", "saved_jobs", "saved_jobs_jobID = ".$saved_jobs->saved_jobs_jobID->GetValue()." AND saved_jobs_candidateID = ".$saved_jobs->saved_jobs_candidateID->GetValue(),$db);
if ($Result == CCGetUserID()) {
$saved_jobs->Visible = False;
}
|
 |
 |
|