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

  • Home
  • SEARCH
  • 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 6070887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:59:04+00:00 2026-05-23T09:59:04+00:00

The first question is how to run a function using the URL, I have

  • 0

The first question is how to run a function using the URL, I have the following function:

function do_curl($start_index,$stop_index){

    // Do query here to get all pages with ids between start index and stop index

    $query = "SELECT * FROM xxx WHERE xxx >= $start_index and xxx <= $stop_index";

Now when I’m trying to do curl.php?start_index=0&stop_index=2 this is not working but when i delete the function and WHERE idnum = 1 it is working.

Now the second question is how ‘compile’ all the fields from the rows to arrays? I have the current code:

    $query = "SELECT * FROM fanpages";
    $result = mysql_query($query) or die(mysql_error());
    while ($row = mysql_fetch_array($result))
{
    $fanpages_query = '\'http://graph.facebook.com/'.$row['page_id'].'\', ';
    echo $fanpages_query;    
}


$fanpages = array($fanpages_query);
$fanpages_count = count($fanpages);
echo $fanpages_count;

echo $fanpages_query; returning

'http://graph.facebook.com/AAAAAA', 'http://graph.facebook.com/BBBBBBB', 'http://graph.facebook.com/CCCCCCCC',

(I don’t have an idea how to do it in a different way, also when im doing it in such a way i can’t delete the final comma which will return PHP-error.)

echo $fanpages_count; returns 1 and like you can see i have 3 there.

Thanks in advance guys!

  • 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-23T09:59:04+00:00Added an answer on May 23, 2026 at 9:59 am

    Do a function call to do the query

    function do_curl($start_index, $stop_index){
        ...
    }
    
    $fanpages = do_curl($_GET['start_index'], $_GET['stop_index']);
    

    For your second question, you can use arrays and the implode function to insert commas:

    while ($row = mysql_fetch_array($result))
    {
        $fanpages_query[] = 'http://graph.facebook.com/'.$row['page_id'];  
    }
    return $fanpages_query;
    

    Then use implode to print them out:

    echo implode(',', $fanpages);
    

    The whole code:

    function do_curl($start_index = 0, $stop_index = null) {
    
        $queryIfThereIsNoStartIndex = '';
        $queryIFThereIsNoStopIndex = '';
        $queryIfBothStartAndStopIndexAreMissing = '';
    
        $result = mysql_query($query) or die(mysql_error());
        while ($row = mysql_fetch_array($result))
        {
            $fanpages_query[] = 'http://graph.facebook.com/'.$row['page_id'];  
        }
        return $fanpages_query;
    }
    
    $fanpages = do_curl($_GET['start_index'], $_GET['stop_index']);
    $fanpages_count = count($fanpages);
    echo implode(',', $fanpages);
    

    And you should totally use mysql_escape_string for escaping the values you add to the query.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Disclaimer First of all, I know this question (or close variations) have been
I'm using jQuery UI accordion for the first time and I have a question:
Original Question mysql-server-6.0.10 I have this problem, I'm using the COMPRESS function to update
first question here. I'm developing a program in C# (.NET 3.5) that displays files
First question on here so please be nice :) I know very little about
First question here: it is a very short yet fundamental thing in Java that
First question is, given a url to an mp4 video, how can I save
First question here so hello everyone. The requirement I'm working on is a small
This question is related to others I have asked on here, mainly regarding sorting
Assume that i have written a program in C++ without using RTTI and run-time

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.