Home » Php » html – Take a single value from a mysql table and assign it to a variable in php or javascript

html – Take a single value from a mysql table and assign it to a variable in php or javascript

Posted by: admin February 23, 2020 Leave a comment

Questions:

What I am trying to do is the following:
I am making a page in which a person will enter a date and depending on the month it will be said if it is summer or winter, everything is fine there, there is a part in which a number is entered and multiplied by a second amount which will come out From the mysql table, I have assigned that if it is summer the number will be 10 and if it is winter the number will be 20, I want that without having to display the whole table in the html and taking the data I need, I can bring that unique data depending of the date on which this so you can do the multiplication.

How to&Answers:

Mysql – select and fetch query can handle dat
Sample –

$selecttb = mysqli_query ($conn, select from TABENAME);

$row = mysqli_fetch_array($selecttb);

Then individual data can be:

$data1 = $row [“COLUMNNAME”];