mysql - PHP detmine numbers in between two numbers then query -


It should be simple, but I can not understand it

 & lt ;? Php $ testid = 240; $ Curid = 251; $ Cal = $ curid - $ testid; Countercurrent $ cal; ? & Gt; 

I want to define the number between two other digits, so for this example it determines that there are 11 numbers between $ testid and $ curid, but I do not have to do this.

I understand that literally understand the number between $ curid - $ testid which will be 241, 242, 243 in this example ... by 251 all the way I am with them Loop is required to make numbers and one query down with each

 $ cal = $ curid - $ testid; Mysql_query ("SELECT * FROM wall WHERE id = '. $. $ .cal". ") // and mysql for each number should exclude each data field with those data. 

Thanks again, you love people.

It assumes that $ Testid $ curid Less than:

  $ testid = 240; $ Curid = 251; $ Num = category ($ testid + 1), ($ curid)); $ Query = 'SELECT * to the wall WHERE id IN' ('. Implode (', ', $ numbers).') ';  

If I print $ query; I get:

  from the SELECT * wall WHERE id (241, 242, 243, 244, 245, 246, 247, 248, 24 9, 250, 251) < / Code> 

Then just do your query:

  mysql_query ($ query);  

More about more


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -