Skip to main content
Topic: Registering user - SQL query problem (Read 761 times) previous topic - next topic

Registering user - SQL query problem

My problem: on my app registration form, the user must write his email address: x.y.z@domian.com.
After write the emil,then I'd wilke select the user country from database:
Code: [Select]
"SELECT id AS value, name AS label FROM countries WHERE email LIKE CONCAT('%','".substr($lookup_email, strpos($lookup_email, '@') + 1)."','%')"
Parameters: $lookup_email
But in SELECT options are all cauntries, not only one. If parameter list is empty, then listed all countries too.

Re: Registering user - SQL query problem

Reply #1
This Query work perfect in PhpMyAdmin =>
Code: [Select]
"SELECT id AS value, name AS label FROM countries WHERE email LIKE CONCAT('%',(SELECT SUBSTRING( 'foo@country.com' , (SELECT POSITION('@' IN 'foo@country.com' )+1))))"

But empty the select field in PHPRad 2.7.3:
Code: [Select]
"SELECT id AS value, name AS label FROM countries WHERE email LIKE CONCAT('%',(SELECT SUBSTRING( ? , (SELECT POSITION('@' IN ? )+1))))" , array($lookup_email, $lookup_email)

The email field is TextField input.

Somebody help me please!