How does the discuz plug-in operate databases?

Source: Internet
Author: User
How does the discuz plug-in operate databases? Add. inc. php:
 $q1,);$cone = DB::insert('pre_xyk',$insert_array);?> 


Echo $ q1; there is output, but how can I not write data?

How does the DZ plug-in operate databases?

How can I write add. inc. php correctly? Thank you!


Reply to discussion (solution)

require './source/class/class_core.php';C::app()->init();$insert_array = array('classname'=>'test','uid'=>1,'dateline'=>time());if(DB::insert('home_class',$insert_array)){echo 'ok';}/*ok*/

If the insertion fails, discuz should report an error. why is there no error prompt?
Guess:
1. class_core.php is not introduced and is not initialized. it cannot be called using DB.
2. pre_xyk indicates the full name of the table. the default value is not the prefix (if any)

 init(); $insert_array = array(    'baankid'=>1,);if(DB::insert('xyk',$insert_array)){    echo 'ok';}?> 


Even so, no data is written,
Plug-in blocks do not need to define add. inc. php?

If it fails, there will always be a prompt, that is, an error report.
You can try to access this page separately.

Access this page separately without any output, blank

include '../source/class/class_core.php';$discuz = & discuz_core::instance();$discuz->init();print_r($_G);


In this case, there is a variable output. why:

Include '../source/class/class_core.php ';

../Is there output./Is there no output?

Require '.. /.. /.. /source/class/class_core.php '; // introduce the system core file $ discuz = & discuz_core: instance (); // the following code creates and initializes an object $ discuz-> cachelist = $ cachelist; $ discuz-> init (); // The above is the core code that calls the discuz public execution class and so on // write the database $ arr = array (); $ arr ['userid'] = $ userid; $ count1 = DB :: insert ('xyk', $ arr );


This can be written, and I don't understand why:
Require '../.../../source/class/class_core.php'; // introduce the system core file


In this way, you cannot:
Require './source/class/class_core.php'; // introduce the system core file


Path not set?

.. Is the first-level directory to start searching
Is the current directory to start searching

Thank you very much for your patience at jam00. thank you!

However, none of the plug-ins I see will use ../../../

Both./and can work normally.

The directory layers are the same. why must I use ../../../? Why not use an absolute path?

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.