Home Community Mys-Script Creative Off-Topic |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to not show clicked adoptables
Title sense make none
Alrighty so i've spent ages and I don't know how to do this. XD Hopefully someone can help :c I have a random adoptables page that shows 10 random adoptables for people to click. It's pretty much just the random adopt thing from stats.php but with a limit of 10 instead of 5. :B What I want is for that page to only show (random 10 of) the adoptables that user hasn't clicked that day instead of any adoptable. |
#2
|
||||
|
||||
Well this can get a bit tricky, you will need to utilize the other table in the database called prefix_vote_voters. Before displaying the owned adoptables available to click, filter out those who have been fed on the same day by the same user as it shows in table prefix_vote_voters. The rest of adoptables shown on the page will be those who are to be fed.
__________________
Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
#3
|
|||
|
|||
:P Alrighty I don't know how to do that.
Thanks for the help. ^^ |
#4
|
||||
|
||||
No worries, I will give you more details on how to accomplish this. Can you show me what you've done with the 10 random adoptables page? It would be easier for me to tell you what to do this way, otherwise Id have to write an arbitrary script and explain some concepts that may not make much sense to you.
__________________
Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
#5
|
|||
|
|||
Yup yup
Code:
<?php include("functions/functions.php"); include("functions/functions_users.php"); include("functions/functions_adopts.php"); include("inc/lang.php"); //***************// // START SCRIPT // //***************// $article_title = "Random adoptables"; $article_content = $article_content."<br><h3>".$lang_randomadopts."</h3>".$lang_randomtext."<br> <br /><form> <input type='button' onClick='history.go(0)' value='Refresh'> </form><br><table> <tr> <th>Adoptable Image: </th> <th>Adoptable Name: </th> <th>Owned By: </th> <th>Total Clicks: </th> <th>Current Level: </th> </tr>"; // Loop out code... $query = "SELECT * FROM ".constant("PREFIX")."owned_adoptables, ".constant("PREFIX")."adoptables, ".constant("PREFIX")."levels WHERE " .constant("PREFIX")."adoptables.type = ".constant("PREFIX")."owned_adoptables.type AND ".constant("PREFIX")."levels.thisislevel = ".constant("PREFIX")."owned_adoptables.currentlevel AND ".constant("PREFIX")."levels.adoptiename = ".constant("PREFIX")."adoptables.type" ." ORDER BY RAND() DESC LIMIT 10"; $stmt = $adopts->query($query); //Loop out code while ($row = $stmt->fetchObject()) { $aid=$row->aid; $currentlevel=$row->currentlevel; $owner=$row->owner; $type=$row->type; $name=$row->name; $eggimage=$row->eggimage; $usealternates=$row->usealternates; $totalclicks=$row->totalclicks; $primaryimage=$row->primaryimage; $alternateimage=$row->alternateimage; if ($usealternates=='yes') { $image = $alternateimage; } else { $image = $primaryimage; } if ($currentlevel==0) { $image = $eggimage; } if ($image=='') { $image = $primaryimage; } $article_content = $article_content."<tr> <td><center><a href='levelup.php?id={$aid}'><img src='{$image}' border=0></a></center></td> <td><center>{$name}</center></td> <td><center><a href='profile.php?user={$owner}'>{$owner}</a></center></td> <td><center>{$totalclicks}</center></td> <td><center>{$currentlevel}</center></td> </tr>"; } $article_content = $article_content."</table><br><form> <input type='button' onClick='history.go(0)' value='Refresh'> </form>"; //***************// // OUTPUT PAGE // //***************// echo showpage($article_title, $article_content, $date); ?> |
#6
|
||||
|
||||
Well here is the modified version of your script. Lemme know if it works and I will see what I can do to help you:
PHP Code:
__________________
Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
#7
|
|||
|
|||
Yaaaaay it works. Thanks so much for the help. :D
Well sometimes it doesn't always show 10 even if there's over 10 left (one refresh it showed 9 then 10 again after) or it'll show random amounts below 10 (if I don't click anything then one refresh it might show 2 then 5 then 3 or something). |
#8
|
||||
|
||||
Oh I see, remove the 'LIMIT 10' from sql query and it should work for you.
The script uses a counter to check if the number of random adoptables loaded hit 10 or not, so this sql query is redundant and needs to be modified. Lemme know what happens once you revise the sql query, if it fails to function normally I will take a deeper look into the code.
__________________
Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
#9
|
|||
|
|||
Yaaaaay it's fixed. :D
Thank you <3 |
#10
|
||||
|
||||
You are very welcome, glad I can be of any help.
Hall of Famer
__________________
Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Ads won't show. | Mortain | Questions and Supports | 2 | 12-01-2015 02:46 AM |
Only display pets a user hasn't clicked in daycare | Hwona | Suggestions and Feature Requests | 3 | 08-16-2014 04:53 PM |
I can't make my adoptables show up/active! | MintChip | Questions and Supports | 25 | 10-04-2012 09:45 PM |
show adoptables | Blackmagic | Questions and Supports | 0 | 11-02-2009 02:36 AM |
is there anyway to find out how many times someone has clicked adoptables? | aroymart | Questions and Supports | 4 | 04-13-2009 03:36 PM |
What's New? |
What's Hot? |
What's Popular? |