Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 06-03-2012, 12:13 PM
Lonin Lonin is offline
Member
 
Join Date: Jan 2012
Location: England
Posts: 17
Gender: Female
Credits: 9,891
Lonin is on a distinguished road
Default 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.
__________________
Reply With Quote
  #2  
Old 06-03-2012, 12:41 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 340,264
Hall of Famer is on a distinguished road
Default

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.
Reply With Quote
  #3  
Old 06-04-2012, 03:29 AM
Lonin Lonin is offline
Member
 
Join Date: Jan 2012
Location: England
Posts: 17
Gender: Female
Credits: 9,891
Lonin is on a distinguished road
Default

:P Alrighty I don't know how to do that.
Thanks for the help. ^^
__________________
Reply With Quote
  #4  
Old 06-06-2012, 01:01 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 340,264
Hall of Famer is on a distinguished road
Default

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.
Reply With Quote
  #5  
Old 06-07-2012, 03:37 AM
Lonin Lonin is offline
Member
 
Join Date: Jan 2012
Location: England
Posts: 17
Gender: Female
Credits: 9,891
Lonin is on a distinguished road
Default

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);

?>
__________________
Reply With Quote
  #6  
Old 06-07-2012, 01:10 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 340,264
Hall of Famer is on a distinguished road
Default

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:
<?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 .= "<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
$counter 0;
while(
$row $stmt->fetchObject()){
    
$date date('Y-m-d');
    
$ip $_SERVER['REMOTE_ADDR']; 
    
$where_clause = ($isloggedin == "yes")
                    ?
"adoptableid='{$row->aid}' and username = '{$loggedinname}' and date = '{$date}'"
                    
:"adoptableid='{$row->aid}' and ip = '{$ip}' and date = '{$date}'";
    
$vote $adopts->select("vote_voters", array("void"), $where_clause)->fetchColumn();    
    if(
is_numeric($vote)){
       
// The adoptable has been clicked by the user, so we will not load this data
       
continue;
    }
    
    if (
$row->currentlevel==0)  $image $row->eggimage
    elseif (
$row->$usealternates=='yes'$image $row->alternateimage;
    else 
$image $row->primaryimage

    
$article_content .= "<tr>
        <td><center><a href='levelup.php?id=
{$row->aid}'><img src='{$image}' border=0></a></center></td>
        <td><center>
{$row->name}</center></td>
        <td><center><a href='profile.php?user=
{$row->owner}'>{$row->owner}</a></center></td>
        <td><center>
{$row->totalclicks}</center></td>
        <td><center>
{$row->currentlevel}</center></td>
      </tr>"
;
      
    
$counter++;
    if(
$counter >= 10){
       
// Already loaded ten adoptables, time to break out of the loop.    
       
break;
    }   
}

$article_content .= "</table><br><form>
<input type='button' onClick='history.go(0)' value='Refresh'>
</form>"
;


//***************//
//  OUTPUT PAGE  //
//***************//

echo showpage($article_title$article_content$date);

?>
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #7  
Old 06-08-2012, 12:48 PM
Lonin Lonin is offline
Member
 
Join Date: Jan 2012
Location: England
Posts: 17
Gender: Female
Credits: 9,891
Lonin is on a distinguished road
Default

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).
__________________
Reply With Quote
  #8  
Old 06-08-2012, 01:04 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 340,264
Hall of Famer is on a distinguished road
Default

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.
Reply With Quote
  #9  
Old 06-08-2012, 01:28 PM
Lonin Lonin is offline
Member
 
Join Date: Jan 2012
Location: England
Posts: 17
Gender: Female
Credits: 9,891
Lonin is on a distinguished road
Default

Yaaaaay it's fixed. :D
Thank you <3
__________________
Reply With Quote
  #10  
Old 06-08-2012, 01:29 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 340,264
Hall of Famer is on a distinguished road
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -5. The time now is 02:00 PM.

Currently Active Users: 9125 (0 members and 9125 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636