Universal Form Validator PHP Support Product Page
Answered
How do I make a form editable from the database but check CHANGED username and password exist.
Asked 28 Feb 2013 22:20:12
1
has this question
28 Feb 2013 22:20:12 Joe Horton posted:
How do I make a form editable from the database but check username and password only if they change it, not tab from that field. For example I want to allow a user to change their username but I want to make sure it doesn't already exist in the database. Currently if it is them and they tab through it obviously thinks it's already in the database and won't let them continue. Hope my question makes sense. Replies
Replied 01 Mar 2013 11:58:59
01 Mar 2013 11:58:59 Teodor Kuduschiev replied:
Hello,
Unfortunately this is not possible.
Unfortunately this is not possible.
Replied 08 Apr 2013 22:20:50
08 Apr 2013 22:20:50 Joe Horton replied:
Actually I created a work around... I set a session variable for the original value, then put an if statement to check for if it's the original or not, then run the database query. Seems to work.
if ($_SESSION['originalusername'] != $_GET[$field]){
$query_dmxExists1 = 'SELECT * FROM '.$table.' WHERE '.$column.'=\''.$_GET[$field].'\'';
$dmxExists1 = mysql_query($query_dmxExists1, $sigsttngs) or die(mysql_error());
If (mysql_num_rows($dmxExists1) > 0)
{echo $invalid;}else{echo $valid;}
}
else{
echo $valid;
}
Also added if (!session_id()) session_start(); at the top.
if ($_SESSION['originalusername'] != $_GET[$field]){
$query_dmxExists1 = 'SELECT * FROM '.$table.' WHERE '.$column.'=\''.$_GET[$field].'\'';
$dmxExists1 = mysql_query($query_dmxExists1, $sigsttngs) or die(mysql_error());
If (mysql_num_rows($dmxExists1) > 0)
{echo $invalid;}else{echo $valid;}
}
else{
echo $valid;
}
Also added if (!session_id()) session_start(); at the top.