Newby Database query

cyberrocker 04 Aug, 2016
Hey guys,
This a fantastic module...Thanks very much for taking this time to write a piece of art.

This is likely to be a Newbee question. though i have been racking my brain for close to 7 hours now, trying many different configurations.
I have a form (obviously) that needs to check if the Email value exists (has already been written to) in the database. If is has, then continue, if not, then it goes to an event loop..

The latest effort is :
<?php
return array('Data45.Email' => $form->data['Email']);
?>

And it still goes to not_found
Config is for DB READ :
Enable Model ID: Yes
Model ID: Data45
Fields: Email
Order: Email
Can some one please help??

Thanks in advance
GreyHead 05 Aug, 2016
Hi cyberrocker,

I assume that the code you have here is in the DB Read Conditions box? Please try
<?php
return array('Email' => $form->data['Email']);
?>
without the Model ID.

If you add a Debugger action to the event you can see the database query that is being created. That can help in debugging.

Bob
cyberrocker 05 Aug, 2016
Thanks very much for the quick response Bob.
Though this still hasn't worked and i did try that code earlier...

I have now the not_found clause and turned on debugging.. And this is what have
[Queries] => Array
(
[0] => SELECT `Data`.`Email` AS `Data.Email` FROM `e6dh5_jobs` AS `Data` WHERE `Data`.`Email` IS NULL
)

Correct me if i am wrong, but shouldnt WHERE `Data`.`Email` IS NULL be WHERE `Data`.`Email` IS {an email address}
?

Thanks in advance
GreyHead 05 Aug, 2016
Hi cyberrocker,

Yes, that's correct - so presumably $form->data['Email'] doesn't have a value set at that point?

Bob
cyberrocker 05 Aug, 2016
Well the Data Array has the Email value
[Email] => ***HIDDEN**
GreyHead 05 Aug, 2016
Hi cyberrocker,

And what is hiding it?

Bob
cyberrocker 05 Aug, 2016
Sorry Bob,
Just for security and Spam reasons, my email address
GreyHead 05 Aug, 2016
Hi cyberrocker,

Please post the whole of the Debugger output - use Privacy tags if you like (the padlock icon at the right) or PM them to me.

Bob
cyberrocker 05 Aug, 2016

This is private content



You can see where it handles the data base OK... but seams to me like It doesn't recognise [Email] =>

This is private content

as being in $form->data['Email']
cyberrocker 06 Aug, 2016
Bob. Thanks very much for your time and help... I still don't know what the problem was, though i removed the DB table, and database read function then rebuilt it and it now works...

Thanks again
Ben
This topic is locked and no more replies can be posted.