View Full Version : Allow different spelling of names
SilverDragonTears
12-29-2012, 02:32 PM
If someone has the name Holly for an adopt, how can I make it so that another person can use HoLLy, or some other variation of the same name?
Abronsyth
12-29-2012, 02:37 PM
Not that I can answer this...but are users currently unable to give their pet the same name of another existing pet..?
SilverDragonTears
12-29-2012, 02:38 PM
If you have it set up that way which I do. And I think that it's default.
Hall of Famer
12-29-2012, 02:55 PM
You can use strcmp() function to validate the name of an adoptable with another. This one is case sensitive, so Adopt and adopt are not the same.
SilverDragonTears
12-29-2012, 03:03 PM
Where do I place that at?
Hall of Famer
12-29-2012, 04:28 PM
Place it where it validates adoptables name.
SilverDragonTears
12-30-2012, 10:20 AM
I tried this but I don't think it's correct as it didn't work.
else{
$stmt = $adopts->query("SELECT * FROM ".constant('PREFIX')."owned_adoptables WHERE name='{$more}'");
$row = $stmt->fetchObject();
if(!is_object(strcmp($row))){
// The name has not yet been used, we are good to go!
Hall of Famer
12-30-2012, 10:42 AM
Of course its not correct lol. You dont know how to use the strcmp() function dont ya? It accepts two arguments, not one. The arguments have to be strings, not objects. Try this:
$name = $adopts->query("SELECT name FROM ".constant('PREFIX')."owned_adoptables WHERE name='{$more}'")->fetchColumn();
if(!strcmp($name, $more)){
// The name has not be used...
}
else{
// Show error message
}
SilverDragonTears
12-30-2012, 11:29 AM
Rawr, I'm not putting it in the right place :(
$name = $adopts->query("SELECT name FROM ".constant('PREFIX')."owned_adoptables WHERE name='{$more}'")->fetchColumn();
if(!strcmp($name, $more)){
// The name has not yet been used, we are good to go!
$adopts->query("UPDATE ".constant('PREFIX')."owned_adoptables SET name='{$more}' WHERE aid='{$id}' and owner='{$loggedinname}'");
It says it worked but it didn't change the name.
Hall of Famer
12-31-2012, 03:03 AM
umm are you sure the query is executed correctly? I mean, do the variables $id and $more exist? If so, what values do they hold? Use var_dump($id) and var_dump($more) to validate their values. If one of them turns out to be blank or null, you know the problem.
kristhasirah
12-31-2012, 09:03 PM
theres a simple way:
if the user puts a space before the desired name, the site will recognize that name as a different name.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.