Writing menu ideas is stuck, please

Source: Internet
Author: User
I am a PHP cainiao. I am stuck with this problem. If I want to select a package, I will insert the menu bar directly and the SQL statement will be stuck .. I don't know why I wrote Table A: bigtype [2] Table B: smalltype [3] {code ...}

I am a PHP cainiao. I am stuck with this problem. If I want to select a package, I will insert the menu bar directly and the SQL statement will be stuck .. I don't know why.

Table A: bigtype [2] Table B: smalltype [3]

If (isset ($ _ POST ['submit ']) {$ cd =$ _ POST ['bigtype']; $ query = "insert into smalltype... Please help me ····"}

Reply content:

I am a PHP cainiao. I am stuck with this problem. If I want to select a package, I will insert the menu bar directly and the SQL statement will be stuck .. I don't know why.

Table A: bigtype [2] Table B: smalltype [3]

If (isset ($ _ POST ['submit ']) {$ cd =$ _ POST ['bigtype']; $ query = "insert into smalltype... Please help me ····"}

$ Query = "INSERTsmalltype(bid,smalltype) VALUES ('". mysql_real_escape_string ($ bid)."', '". mysql_real_escape_string ($ smalltype )."')";

Are two tables associated with IDs?
If yes, assume that the first table is A and the last table is B.
Select A. * from A, B where A. id = B. id and B. bigtype = 'variable parameter ';

phpif(isset($_POST['submit'])){    $big_type = $_POST['bigtype'];    $small_type = $_POST['small_type'];    $query="INSERT INTO smalltype (bid, smalltype)VALUES(".quote($big_type).",".DB::quote($small_type).")";    DB::query($query);}

I don't understand what I want to do ......
Do not add redundant information to the database. If bigtype and small are divided into two tables, you do not need to copy bigtype again and put it in smalltype. You should connect it with union in SELECT.

It should be based on $ cd =$ _ POST ['bigtype'], select table B to get BID, and then insert Table A (BID, smalltype)

This should be the background that returns all the data in JSON format. It is more appropriate to use the front-end JS control.

Related Article

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.