How to obtain the array value in php

Source: Internet
Author: User
In php, how do I obtain the array value? I have a contents2 table to obtain the name value $ result = mysql_query (& quot; selecta. namefromcontents2awherea. level & lt; '$ level' and how to obtain the array value in php
I have a contents2 table that obtains the name value.
$ Result = mysql_query ("select a. name from contents2 a where a. level <'$ level' and a. group =' $ group '");
$ Myrow = mysql_fetch_array ($ result );
The name obtained from this has several values, for example, Zhang San 1, Zhang San 2, and Zhang San 3.
I need to check the value in contents3 based on the name. how can I write an SQL statement?
$ Result2 = mysql_query ("select * from contents3 a where a. name =? ")
Is how to put the array value in a. name =? Here

------ Solution --------------------
$ Myrow = mysql_fetch_array ($ result );
="
While ($ myrow = mysql_fetch_array ($ result )){
$ Arr [] = $ myrow [0];
}

$ S = "'". join ("', '", $ arr )."'";
$ Result2 = mysql_query ("select * from contents3 a where a. name in ($ s )")

------ Solution --------------------
You can directly put the SQL statement query results in the select in () brackets without having to obtain the array values.

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.