Thanks Simon and Ken,
This may be larger than I can handle but will start and make an effort... and hopefully learn from it.
The monthly_temp.php and monthly-data.php scripts both start with the same lines 1 through 37 which includes
Code: Select all
<?php
//include the information needed for the connection to MySQL data base server. This file contains the databasename,hostname, usernme, and password. For an alternative method:http://php.about.com/od/phpwithmysql/qt/connect_sql_php.htm or google connect to mysql using php
include ("dbconfig.php");
// require_once("cumuluswebtags.php");
// connect to the MySQL database server
$db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error());
// select the database
mysql_select_db($database) or die("Error connecting to db.");
I have looked at the tutorial link Ken provided and presume if I make these changes
Script line 32: // connect to the MySQL database server
Existing line 33: $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error());
Modify line 33: $db = mysqli_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysqli_connect_error());
Tutorial example old: $connection = mysql_connect( 'host', 'username', 'password', new_link,flags);
Tutorial example new: $connection = mysqli_connect( 'host', 'username', 'password', 'database', 'port', 'socket');
Script line 36: // select the database
Existing line 37: mysql_select_db($database) or die("Error connecting to db.");
Modify line 37: mysqli_select_db($database) or die("Error connecting to db.");
Tutorial example old: $database = mysql_select_db( 'database', $link);
Tutorial example new: $database = mysqli_select_db($link, 'database');
Further the scripts have somewhat similar code for getting the data
Code: Select all
// the actual query for the grid data
$SQL = "SELECT LogDate, Year(LogDate) as Year, maxtemp, max(IF(month(logdate)=1, maxtemp,null)) as January, max(IF(month(logdate)=2, maxtemp,null))as February, max(IF(month(logdate)=3, maxtemp,null))as March, max(IF(month(logdate)=4, maxtemp,null))as April, max(IF(month(logdate)=5, maxtemp,null))as May, max(IF(month(logdate)=6, maxtemp,null))as June, max(IF(month(logdate)=7, maxtemp,null))as July, max(IF(month(logdate)=8, maxtemp,null))as August ,max(IF(month(logdate)=9, maxtemp,null))as September,max(IF(month(logdate)=10, maxtemp,null))as October, max(IF(month(logdate)=11, maxtemp,null))as November, max(IF(month(logdate)=12, maxtemp,null))as December, max(maxtemp) as total FROM Dayfile group by year";
$resultmaxtemp = mysql_query($SQL)or die('Error: ' . mysql_error());
$SQL = "SELECT LogDate, Year(LogDate) as Year, avgtemp, round(avg(IF(month(logdate)=1, avgtemp,null)),1) as January, round(avg(IF(month(logdate)=2, avgtemp,null)),1)as February, round(avg(IF(month(logdate)=3, avgtemp,null)),1) as March, round(avg(IF(month(logdate)=4, avgtemp,null)),1)as April, round(avg(IF(month(logdate)=5, avgtemp,null)),1)as May, round(avg(IF(month(logdate)=6, avgtemp,null)),1)as June, round(avg(IF(month(logdate)=7, avgtemp,null)),1)as July, round(avg(IF(month(logdate)=8, avgtemp,null)),1)as August, round(avg(IF(month(logdate)=9, avgtemp,null)),1) as September, round(avg(IF(month(logdate)=10, avgtemp,null)),1) as October, round(avg(IF(month(logdate)=11, avgtemp,null)),1) as November, round(avg(IF(month(logdate)=12, avgtemp,null)),1)as December, round(avg(avgtemp),1) as total FROM Dayfile group by year";
$resultavgtemp = mysql_query($SQL)or die('Error: ' . mysql_error());
etc....
and presume I can replace all the occurrences of mysql_select, mysql_query, mysql_fetch and mysql_error with mysqli_select, mysqli_query, mysqli_fetch and mysqli_connect_error.
Before I start to make those changes does that appear to be correct?
Thanks for your patience and guidance,
Paul