List:General Discussion« Previous MessageNext Message »
From:boris hajduk Date:November 17 2001 8:49pm
Subject:many similar requests -> 1 request
View as plain text  
hi fellow mysql users :)

i'm programming a little application, and i do the following :


for ($i=0 ; $i<200 ; $i++)
{
  $result=mysql_query("select $i, title from book where position1=$i \
                       or position2=$i"); // this query returns only 1 row
  $row=mysql_fetch_row($result);
  print("position: $row[0]  --   title: $row[1]  \n");
}

this generates 200 sql queries... :/

do you see a way to make 1 sql query that would return my 200 rows ?

maybe something like :
select "(increment j 0 -> 200)" , title from book where position1=j \
  or position2=j;


note: given a number between 0 and 199, the number is stored in
position1 OR position2 , but never both.

any idea ?

-- 
 Boris Hajduk                   bhajduk@stripped

Thread
many similar requests -> 1 requestboris hajduk17 Nov
  • Re: many similar requests -> 1 requestBruce Ferrell17 Nov
    • Re: many similar requests -> 1 requestboris hajduk17 Nov
      • Re: many similar requests -> 1 requestSergei Golubchik17 Nov
        • Re: many similar requests -> 1 requestSergei Golubchik17 Nov
          • Re: many similar requests -> 1 requestboris hajduk18 Nov
            • Re: many similar requests -> 1 requestSergei Golubchik18 Nov
              • Re[2]: many similar requests -> 1 requestboris hajduk18 Nov
Re: many similar requests -> 1 requestAnvar Hussain K.M.19 Nov