Using AJAX to manipulate database issues in the CI framework

Source: Internet
Author: User
Tags database issues
Front desk:
$con = mysql_connect (' localhost ', ' root ', '), if (! $con) {die (' Could not connect: '). Mysql_error ());  }mysql_select_db ("Test", $con); mysql_query ("Set names UTF8");//$sql = "SELECT * from Ecm_acategory"; $sql = "INSERT INTO Data (name) VALUES (' 999 '), echo $sql; $result = mysql_query ($sql); Mysql_close ($con);? >

Help, local testing without CI, so write no problem, add a CI, the path on the top of a few also do not work, do not know how to go. Thank you, first!

Reply to discussion (solution)

You ("GET", " project_c/add_zijiedian/" +str1+str,true);
Then look at the source code in the browser

The SQL statements are as follows
Insert budget Table $this->db->query ("Select @myLeft: =pleft from constrproj where  constrprojname = ' $dangqiandianname '" ); $this->db->query ("UPDATE constrproj SET pright = pright + 2 WHERE pright > @myLeft"); $this->db->query ("U PDATE constrproj SET pleft = pleft + 2 WHERE pleft > @myLeft "); $query 3 = $this->db->query (" SELECT * from CONSTRPR OJ where constrprojid= (select min (Constrprojid) from Constrproj) "), $arr = $query 3->result_array (); $ParentID = $arr [0 [' Constrprojid '];//echo '; $this->db->query ("INSERT into Constrproj (Constrprojname,pleft,pright,parentid, KINDLVL) VALUES (' $zijiediandianname ', @myLeft + 1, @myLeft +2, ' $ParentID ', 1) '), $query 2 = $this->db->query (" SELECT * from Constrproj ");    $result _count2 = count ($query 2->result ());

is the Pleft value not getting it?

Pleft cannot be empty
Your negative value to Pleft is @myLeft + 1
Obviously @myLeft is null value

Thank you, Seniors!
Ask a question, now plug is plugged in, but in the database Chaos (the page default encoding is UTF-8, database encoding is utf-8), this and get transfer parameters have a relationship? and using Ajax.

The first diagram is to assign values to the page, call the control layer, and the second graph is the control layer to get the value modulation model

Thank you.

That's not garbled, but URL encoding
Decode before storage (UrlDecode)

Younger generation, please advise. It seems wrong to write like this. The database is not plugged in.

Okay, thanks!

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