WeChat-php+mysql question. How do I tell if a string matches a regular expression in a data table worth data?

Source: Internet
Author: User

Question 2. How can I tell which rule a string conforms to in a data table?

Public platform Development,

Start with a timetable, that is, the schedule is handled by Function1 (which is, of course, set in the database, and now, for example, fixed),

Starting with 2015, ^2015 is handled by function2,

Completely equals 报名 , that is ^ registration $ is processed by Function3.

In the data table is

Rule function priority (Precedence)
^ Timetable Function1 1
^2015 Function2 1
^ Registration $ Function3 1
...... ...... ......

How do I get the value to determine which one it corresponds to (assuming that the priority issue is not considered)?

Question 1. How to determine a value in a range of data tables

Membership form,
Id,username,password,truename,avatar,score,balance,add_time,regip

Rating table,
0-100 is level1.
101-500 Level2
501-1500 LEVEL3

Now get the user's points, say 299. How to tell if it is Level2?

The loop is indeed possible. But the efficiency is not high. And this is set by the user is not fixed.

Reply content:

Question 2. How can I tell which rule a string conforms to in a data table?

Public platform Development,

Start with a timetable, that is, the schedule is handled by Function1 (which is, of course, set in the database, and now, for example, fixed),

Starting with 2015, ^2015 is handled by function2,

Completely equals 报名 , that is ^ registration $ is processed by Function3.

In the data table is

Rule function priority (Precedence)
^ Timetable Function1 1
^2015 Function2 1
^ Registration $ Function3 1
...... ...... ......

How do I get the value to determine which one it corresponds to (assuming that the priority issue is not considered)?

Question 1. How to determine a value in a range of data tables

Membership form,
Id,username,password,truename,avatar,score,balance,add_time,regip

Rating table,
0-100 is level1.
101-500 Level2
501-1500 LEVEL3

Now get the user's points, say 299. How to tell if it is Level2?

The loop is indeed possible. But the efficiency is not high. And this is set by the user is not fixed.

You two questions, can you think for a moment, for example, the question
0-100 is level1.
101-500 Level2
501-1500 LEVEL3
You record the user's points field in the membership table, 299 is a value, and then you to these levels, do a configuration file, this can be you define or give the user to define the generated configuration file, according to a certain value is broken, which level, do not need additional judgment

Q1 can be a constant array or configure a config file in the background, each time you fetch the information, go to the array to fetch the level.

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