![]() |
|
#1
|
||||
|
||||
|
When a user names their pet and the name is already taken, how can I show that? I have it set where names are unique.
Code:
// We are renaming an adoptable
// Now we see if the adoptable actually exists...
$stmt = $adopts->query("SELECT * FROM {$prefix}owned_adoptables WHERE owner='{$loggedinname}' and aid='{$id}'");
$row = $stmt->fetchObject();
if($row->aid == $id)
{
$image = getcurrentimage($id);
if($more == "")
{
$article_title = "Rename {$row->name}";
$article_content = "<img src='{$image}'><br />{$lang_rename}{$row->name}{$lang_rename2}<br />
<form name='form1' method='get' action='myadopts.php'>
<p>Adoptable Name:
<input name='more' type='text' id='more'>
<input name='id' type='hidden' id='id' value='{$id}'>
<input name='act' type='hidden' id='act' value='rename'>
</p>
<p>
<input type='submit' name='Submit' value='Rename Adoptable'>
</p>
</form>";
}
else
{
// We are renaming the adoptable
|
|
#2
|
||||
|
||||
|
Well it isnt really difficult, just find this part in your script:
PHP Code:
PHP Code:
__________________
![]() Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
|
#3
|
|||
|
|||
|
Assuming you have a unique index on the name field, this can be achieved without any additional query.
PHP Code:
Last edited by fadillzzz; 03-27-2012 at 03:15 AM. |
|
#4
|
||||
|
||||
|
Good idea Fadillzzz, $stmt should return false if the query fails. This should significantly reduce the memory consumption for cases that the script merely checks if a row exists. Also it is better just to select the field name from the database instead of using '*', I just showed her an example of how to do this kind of trick though.
__________________
![]() Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
|
#5
|
||||
|
||||
|
Hof yours didn't work :/
|
|
#6
|
||||
|
||||
|
Pardon me for being ignorant... where do I put this and what do I put in the ('...')
Quote:
|
|
#7
|
||||
|
||||
|
Oh my I must suffered from a lack of sleep then, lol. Remove this part from the very first line and it should work:
PHP Code:
__________________
![]() Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
|
#8
|
||||
|
||||
|
What would I do without you Hof?
|
|
#9
|
||||
|
||||
|
lol you flattered me. And I apologize for giving you the wrong codes in the first place. XD
__________________
![]() Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mys v1.3.4 Know Gender of New Pets Before Naming | Kyttias | Mys v1.3.x Mods | 4 | 08-04-2018 01:13 AM |
| Show Gender while Naming Pet & Name Promo Code Pets | Kyttias | Questions and Supports | 5 | 07-11-2014 02:12 PM |
| Naming and Changing Help | whispwill | Suggestions and Feature Requests | 10 | 08-29-2009 02:58 PM |
What's New? |
What's Hot? |
What's Popular? |