• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Testing to see if a form submitter is a user

Testing to see if a form submitter is a user 11 years 7 months ago #24990

Hi,
I'm trying to build a form where among other things, IF the person is already a user, it skips over the Joomla Registration. If they aren't, we register them.

I built a query to test to see if the email address they provide in the form is already in the user table, but its breaking the form.
$db->setQuery("SELECT * FROM #__users WHERE email = '$email'");
  $db->query();
  $rows = $db->getNumRows();
if ($rows) == 0 {
$query = "INSERT INTO `#__users` (`name`, `username`, `email`, `password`,registerDate) VALUES ('$name','$email','$email','$pass',$today');";
$db->setQuery($query);
$db->query();
$query2="INSERT INTO `#__user_usergroup_map` (`user_id`,`group_id`) VALUES (LAST_INSERT_ID(),'2')";
$db->setQuery($query2);
$db->query();
 }

If I don't test - the last 2 queries to insert a new user work just fine... If I test... the form breaks and the fields are emptied.

I would really appreciate some help!
thanks
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!