CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 database connections

Print topic Send  topic

Author Message
2advanced

Posts:
Posted: 07/18/2015, 12:00 PM

I have a registration page with a username field and on the username field I have beforeshow

but not sure if I am doing it correctly

function checkuser() {
if(isset($_POST['username']))
{
$username= $_POST['username'];
$sql = mysql_query("select user_id from users where soldier='$username");
if(mysql_num_rows($sql))
{
echo 'Taken.';
}
else
{
echo 'OK';
}
}
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 07/18/2015, 2:55 PM

You can use the required Unique attribute in the field properties or write your own validation using a query like:

$db = new clsDBConnection1();

$SQL = "SELECT user_id from users WHERE username = '$username'";
$db->query($SQL);

if($user_id > 0){
$Container->Errors->addError("Username Taken");
}

$db->close();


_________________
Central Coast, NSW, Australia.

View profile  Send private message

Add new topic Subscribe to topic   


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

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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