简体   繁体   中英

code always work in grocery crud although the if condition

I got stuck in a situation quite strange in my code. It seems as the if condition does not work. Here is my code:

if ($mode == "edit") {
    echo "edit mode!";
} 
else {
    $crud->set_rules('u_email','Email','is_unique[users.u_email]');
    echo "NOT edit mode!";
}

When I go to this url: grocery/edit/55 (my edit mode) i see the line edit mode! . The strange thing here is the row below works:

$crud->set_rules('u_email','Email','is_unique[users.u_email]');

That line works, But I still do not get the message NOT edit mode!

Why is this line always works? Why is_unique also works in the edit mode?

Sorry about my bad english. and thanks for all :-)

Do you have something that cover the text? Hard to say why this is happening to you, but is the text "NOT edit mode!" in the source code?

And if you are not in the edit mode, does the text EDIT MODE shows then? I'm trying to exclude every possible error here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM