A problem with Php+mysql

Source: Internet
Author: User
This is the product table.

The part of the red circle is the product's Column group ID.
This is the Product column table.

My question now is:
From the front end, I pass the ID of a product column table through get, how to determine the column ID of the product table and the field of get pass-through after obtaining this ID.

SQL statements


Thank you for your advice.


Reply to discussion (solution)

After taking $n_id.
In the form of a product? $n _id to find out if it exists???, if yes, the ID of the product list, and then can?? The following event.

SELECT * FROM Product list where nav_id= $n _id;

After taking $n_id.
In the form of a product? $n _id to find out if it exists???, if yes, the ID of the product list, and then can?? The following event.

SELECT * FROM Product list where nav_id= $n _id;




I may not be able to express

I'd like to give you an example.
I pass a n_id=10001 through get, I want to use this parameter to find the product table Pro_navid contains 10001 of the data
Returns two data from the blue circle of the product table

... find_in_set (' n_id ', Pro_navid)

Aren't those points in your pro_navid a decimal point? Change to Comma

SELECT * FROM Product Catalog table where nav_id like% $n _id%;

Just that will be a problem!!! This puts: SELECT * from Product Catalog table where nav_id like%, $n _id,%;

Just that will be a problem!!! This puts: SELECT * from Product Catalog table where nav_id like%, $n _id,%;



Okay, I'll try, thank you.

$SQLSTR = "SELECT * from" table where Concat (', ', ' Pro_navid, ', ') like '%, ". $n _id." %,';

... find_in_set (' n_id ', Pro_navid)

Aren't those points in your pro_navid a decimal point? Change to Comma




It's separated by commas, I'll try, thank you.

$SQLSTR = "SELECT * from" table where Concat (', ', ' Pro_navid, ', ') like '%, ". $n _id." %,'";

?? Just?

$SQLSTR = "SELECT * from" table where Concat (', ', ' Pro_navid, ', ') like '%, ". $n _id.",% ' ";

$SQLSTR = "SELECT * from" table where Concat (', ', ' Pro_navid, ', ') like '%, ". $n _id." %,'";

  • 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.