Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

More PHP upgrade questions

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
bigmac
Posts: 159
Joined: Wed 13 May 2009 9:35 am
Weather Station: Davis Vantage Pro 2 Wireless
Operating System: Raspbian wheezy
Location: Nr Ilkley, West Yorks, UK
Contact:

More PHP upgrade questions

Post by bigmac »

Like Ray and others, my website host has also stopped supporting older versions of PHP, so I am now trying to convert all my PHP pages to work with PHP7.2
Having no experience of PHP and having created all my PHP pages with very grateful help from others on here, I have had limited success in converting things but am struggling with some of the SQL queries.
Anything that uses mysql_result in particular is causing me issues as I don't understand how to run it in mysqli, assuming at first that it would be mysqli_result, but it seems not.
So, if this was my query, what would I do to change it to run with mysqli :

Code: Select all

.....$resulttysmtotrain=mysql_result(mysql_query("SELECT SUM(TotRainFall) FROM Afile WHERE (YEAR(LogDate)=YEAR(NOW()) AND (MONTH(LogDate)=$mo))"),0);?>
Thanks in advance.
bigmac
Posts: 159
Joined: Wed 13 May 2009 9:35 am
Weather Station: Davis Vantage Pro 2 Wireless
Operating System: Raspbian wheezy
Location: Nr Ilkley, West Yorks, UK
Contact:

Re: More PHP upgrade questions

Post by bigmac »

With a fresh set of eyes today, I've solved my own issue:

This is the code that replaced it:

Code: Select all

<?php $querytysmtotrain=mysqli_query($con, "SELECT SUM(TotRainFall) FROM Afile WHERE YEAR(LogDate)=YEAR(NOW()) AND MONTH(LogDate)=$mo") or die ('Error: '.mysqli_error());?> 
					<?php $row=mysqli_fetch_row($querytysmtotrain);?> 
					<?php $tysmtotrain=$row[0]; ?>
I am now a mysqli expert :lol: :lol:
Post Reply