Query and Ajax are required in the while loop

Source: Internet
Author: User
I would like to ask you to write the law with me is not the same?
I'm going to use loops to anotherjob the information.

while ($row=mysql_fetch_array($sql)){ 資料顯示...}

But I need $row[id in the loop to do something else.
I have to put the mysql_query in the while so I can know the $row[id of every pen]
Like this

while ($row=mysql_fetch_array($gettimeline)){$sql2 = mysql_query("SELECT * FROM `xxx`WHERE `id` = '".$row['id']."'");}

So, after every anotherjob of information,
He's not going to repeat every $sql2.
Is this the right way to write?
and Ajax, too.
I'm going to delete an article to get the article ID I still have to put it in the while loop.

while ($row=mysql_fetch_array($gettimeline)){$sql2 = mysql_query("SELECT * FROM `xxx`WHERE `id` = '".$row['id']."'");                        }

Every single one of these will have a duplicate of the Ajax and query the more the pen will surely be slower ....
Please ask what will you do?

Reply content:

I would like to ask you to write the law with me is not the same?
I'm going to use loops to anotherjob the information.

while ($row=mysql_fetch_array($sql)){ 資料顯示...}

But I need $row[id in the loop to do something else.
I have to put the mysql_query in the while so I can know the $row[id of every pen]
Like this

while ($row=mysql_fetch_array($gettimeline)){$sql2 = mysql_query("SELECT * FROM `xxx`WHERE `id` = '".$row['id']."'");}

So, after every anotherjob of information,
He's not going to repeat every $sql2.
Is this the right way to write?
and Ajax, too.
I'm going to delete an article to get the article ID I still have to put it in the while loop.

while ($row=mysql_fetch_array($gettimeline)){$sql2 = mysql_query("SELECT * FROM `xxx`WHERE `id` = '".$row['id']."'");                        }

Every single one of these will have a duplicate of the Ajax and query the more the pen will surely be slower ....
Please ask what will you do?

Is "loop" the Meaning of "circle"?

As the number of data bars becomes more numerous, the number of requests also becomes much more common, and this repeated similar external IO will consider merging.
Like what:

SELECT * FROM `xxx` WHERE id in (1,2,3,4,5)
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.