CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 CC - Check if exists before insert

Print topic Send  topic

Author Message
Vince
Posted: 05/06/2002, 7:28 AM

Hi,
When registering on my website, people are asked to enter a special code in a field. There are only 6 valid codes. If the code they enter does not exist, they should get an error message. How do I do this using PHP/mySQL?

Thanks
Nicole
Posted: 05/07/2002, 5:01 AM

Vince,
create Validation event and use lets say dlookup function to find if the record exists, e.g.:
$exist = dLookUP("table_name", "count(*)", "code_field_name = ". ToSQL(get_param(entered_code_field_name), "Number");
if ($exists < 1)
sFormNameErr .="In valid code <br>";

If no records exist user will get error message.

Then select 'Create Validation Rule' flag on form properties to make event work.

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.