MySQL Error when checking for duplicate emails

4 posts by 2 authors in: Forums > CMS Builder
Last Post: July 22, 2013   (RSS)

By gkornbluth - July 18, 2013

Hi All,

I’m not using the membership plugin for this client.

When a "create a new record" form is submitted, I’m trying to check for duplicate email addresses in a table called publicity_listings using  mysql_select_count_from with this code:

  // check for duplicate email
   $count = mysql_select_count_from('publicity_listings', "'".mysql_escape($_REQUEST['email_address'])."' IN (email_address)");
 if ($count > 0 ) { $errorsAndAlerts .= "That Email Address already exists.\n";
 }

but when I submit the form I’m getting this error and I don’t know how to remedy the issue.

mysql_count() MySQL Error: Table 'jeannes_ds.cms_publicity_listings' doesn't exist (at old_alias_functions.php line 6 in function mysql_count)

I’d eventually like to redirect the visitor to an update page that shows the information from the duplicate record, but need to get this resolved first.

I've attached the entire viewer in case it's of some help.

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Attachments:

publicity-add-13.php 17K

By gkornbluth - July 19, 2013

Hi Greg,

How many ways can I say I’m sorry?

I really did play with this for at least a few hours before I finally posted.

The reality is that both versions of the code seem to work now that I (finally) noticed that I had left out the “i” in publicity in the original table name.

Eyes can really play tricks on you.

Sorry for the bother I caused.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By gregThomas - July 22, 2013

Hi Jerry,

Not a problem! Glad you've got it working.

Cheers

Greg

Greg Thomas







PHP Programmer - interactivetools.com