Hello everyone, please help the younger brother to see how the value of this variable to get it

Source: Internet
Author: User
Hello everyone, please help the younger brother to see how to get the value of this variable
Now there is a record in the database, the value of the field "ZhiDuan1" is "Tianqi".
The next record, the value of the field "ZhiDuan1" is "xinqing".
$rs->zhiduan1;

A $tianqi variable is declared in the Web page and is assigned a "Sunny Day",
A $xinqing variable, and assigned a value of "happy",

Now I don't want to use it directly.
Echo $TianQi;
Show "Sunny Days" on the page,

I want to show "Sunny" Through "$rs->zhiduan1",
This makes it easy for $rs->zhiduan1 to show "Happy" when the next record value becomes "xinqing".

How would you like to write code?

------Solution--------------------
The data is written to the database before it is read. Is that what it means?

------Solution--------------------
It's okay to have a field out of the database.
Whether through $rs->zhiduan1 or echo $var
It's not all the same, as long as these two variables come from the database.
In addition to what you said above, on sunny days, you have to have other conditions, such as
The latest weather conditions can be the one with the largest ID
Or the weather of number 3rd, on condition that timeflag=3 is like this.
Or take out an array who knows which one to use, maybe a number of sunny days.

------Solution--------------------
echo ${$rs->zhiduan1};
  • 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.