Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6640821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:43:02+00:00 2026-05-25T23:43:02+00:00

I am trying to return a custom query, which renders each row once, however

  • 0

I am trying to return a custom query, which renders each row once, however sometimes the table it queries is the same… For example. My output code currently is this…

//Query one returns each instance of an object. There are two of the first, one of the second.
13775
13775
66777

//Query two returns each bit of information against the first object. 
// As you can see its loading the first too twice because of the query above being the same...
SID=13775 TOKEN=b8r5x6w53d6cahw
SID=13775 TOKEN=p5ugbeg68b4qixy

SID=13775 TOKEN=b8r5x6w53d6cahw
SID=13775 TOKEN=p5ugbeg68b4qixy

SID=66777 TOKEN=4c85zznh955gjsc

My code is as follows for the above display…

//Query table where firstname, lastname and email all match

$query = "SELECT * FROM lime_all_tokens WHERE fname='".$fname."' AND lname ='".$lname."'";

//execute query
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());

$sid = array();

// see if any rows were returned
if (mysql_num_rows($result) > 0) {
    // yes
    // print them one after another
    $i = 0;
    while($row = mysql_fetch_row($result)) {
        //Shows the SID's
        echo $row[5]."<br />";

        //Add into the DB in order...
        $sid[] = $row[5];   
        $i++;     
    }       
}

// free result set memory
mysql_free_result($result);

for ($j = 0; $j < $i; $j++) {
    $querytokens = "SELECT * FROM lime_tokens_".$sid[$j]." WHERE firstname='".$fname."' AND lastname ='".$lname."'";

    echo $tokens[$j]."<br />";

    //execute query
    $resulttokens = mysql_query($querytokens) or die ("Error in query: $querytokens. ".mysql_error());

    // see if any rows were returned

    //print_r(mysql_fetch_row($resulttokens));

    while($rowtokens = mysql_fetch_row($resulttokens)) {        
        //Display our token
        echo "SID=".$sid[$j]." TOKEN=".$rowtokens[5]."<br />";
        $displayonce = false;
    }       

}


echo "<br /><br /><h2>There are a total of ".$i." calls availible!</h2>";

// free result set memory
mysql_free_result($resulttokens);

// close connection
mysql_close($connection);

How can i get it to return the data properly? i.e

13775
13775
66777

SID=13775 TOKEN=b8r5x6w53d6cahw

SID=13775 TOKEN=p5ugbeg68b4qixy

SID=66777 TOKEN=4c85zznh955gjsc
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:43:03+00:00Added an answer on May 25, 2026 at 11:43 pm

    IMHO you could change first query to:

    SELECT DISTINCT id 
    FROM lime_all_tokens 
    WHERE fname='".$fname."' AND lname ='".$lname."'"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to return a SimpleQuery list that queries a single table and uses
I'm trying to return a custom 404 page using IIS6. (I have a site
Am trying to return the sum of each day of a week in mysql
I want to run a linq query that will return values to my custom
I'm trying to return a Custom type from a PostgreSQL function as follows: DROP
H. I'm trying to construct linq query that dynamicly generate query for custom ordering
I am trying to run a query to update the value of a custom
I'm trying to implement a .NET Custom Validator that uses $.ajax to query a
I've a custom module with custom table, now, i'm trying to make something like
i'm trying to return a custome object from a web service object returned only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.