OOps. Must have been looking somewhere else. The total is NOT displaying in my web page.
Is that because I need a echo statment in the relevant html table cell. If so what would that be.
It might help if I show my page code here.
<?php require_once(‘Connections/scores.php’); ?>
<?php
if (!function_exists(“GetSQLValueString”)) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = “”, $theNotDefinedValue = “”)
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists(“mysql_real_escape_string”) ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case “text”:
$theValue = ($theValue != “”) ? “'” . $theValue . “'” : “NULL”;
break;
case “long”:
case “int”:
$theValue = ($theValue != “”) ? intval($theValue) : “NULL”;
break;
case “double”:
$theValue = ($theValue != “”) ? doubleval($theValue) : “NULL”;
break;
case “date”:
$theValue = ($theValue != “”) ? “'” . $theValue . “'” : “NULL”;
break;
case “defined”:
$theValue = ($theValue != “”) ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET[‘pageNum_Recordset1’])) {
$pageNum_Recordset1 = $_GET[‘pageNum_Recordset1’];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
Guido’s code starts here
$sql = "SELECT
"
. " player_name
"
. " , r1
"
. " , r2
"
. " , r3
"
. " , r4
"
. " , r1+r2+r3+r4 AS total
"
. “FROM scores LIMIT 0, 30 “;
mysql_select_db($database_scores, $scores);
$query_Recordset1 = “SELECT player_name, r1, r2, r3, r4 FROM scores”;
$query_limit_Recordset1 = sprintf(”%s LIMIT %d, %d”, $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $scores) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET[‘totalRows_Recordset1’])) {
$totalRows_Recordset1 = $_GET[‘totalRows_Recordset1’];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=“X-UA-Compatible” content=“IE=Edge” />
<meta name=“viewport” content=“width=device-width, initial-scale=1” />
<title>CSS Page Builder Magic: Layout 2</title>
<script type=“text/javascript” src=“p7csspbm/p7mobile.js”></script>
<link href=“p7csspbm/p7csspbm_02.css” rel=“stylesheet” type=“text/css” />
<link href=“p7csspbm/p7csspbm_print.css” rel=“stylesheet” type=“text/css” media=“print” />
<!–[if lte IE 7]>
<style>
.menutop li {display: inline;}
div, .menuside a {zoom: 1;}
.masthead .banner {width: 100%;}
</style>
<![endif]–>
</head>
<body>
<div class=“content-wrapper”>
<div class=“masthead”>
<div class=“logo”>
<h1>Logo Placeholder</h1>
</div>
<div class=“banner”><img src=“p7csspbm/img/main-picture.jpg” alt=“” /></div>
</div>
<p> </p>
<div class=“columns-wrapper”>
<div class=“content”>
<form action=“FTGsettings/gboscores.php” method=“post” enctype=“multipart/form-data” name=“scoresreport” id=“scoresreport”>
<legend><br />
</legend>
<table width=“95%” border=“0” align=“center” cellpadding=“0” cellspacing=“0”>
<tr>
<td valign=“top”><table width=“80%” border=“1” align=“center” cellpadding=“0” cellspacing=“0”>
<tr>
<th colspan=“2”>GBO round reporter </th>
</tr>
<tr>
<td>Player name</td>
<td><input name=“playername” type=“text” id=“playername” size=“45” maxlength=“45” /></td>
</tr>
<tr>
<td>GBO number </td>
<td><input name=“gbonumber” type=“text” id=“gbonumber” size=“10” maxlength=“10” /></td>
</tr>
<tr>
<td>Your e-mail address </td>
<td><input name=“email” type=“text” id=“email” size=“45” maxlength=“45” /></td>
</tr>
<tr>
<td>Course played </td>
<td><input name=“course” type=“text” id=“course” size=“45” maxlength=“45” /></td>
</tr>
<tr>
<td>Round played </td>
<td><label for=“select”></label>
<select name=“select” size=“1” id=“select”>
<option>Select below</option>
<option>R1</option>
<option>R2</option>
<option>R3</option>
<option>R4</option>
</select></td>
</tr>
<tr>
<td>Score</td>
<td><input name=“score” type=“text” id=“score” size=“3” maxlength=“3” /></td>
</tr>
<tr>
<td>Attach game file</td>
<td><input type=“file” name=“file” /></td>
<td><label for=“Submit”></label></td>
</tr>
<tr>
<td> </td>
<td><input type=“submit” name=“Submit” value=“Submit” />
<input name=“reset” type=“reset” id=“reset” value=“Reset!” /></td>
</tr>
</table></td>
</tr>
</table>
</form>
<p> </p>
<p> </p>
<?php do { ?>
<table width=“610” border=“1” align=“center”>
<tr>
<td width=“91”><?php echo $row_Recordset1[‘player_name’]; ?></td>
<td width=“169”><?php echo $row_Recordset1[‘r1’]; ?></td>
<td width=“73”><?php echo $row_Recordset1[‘r2’]; ?></td>
<td width=“75”><?php echo $row_Recordset1[‘r3’]; ?></td>
<td width=“73”><?php echo $row_Recordset1[‘r4’]; ?></td>
<td width=“89”></td> html table cell where total needs to go
</tr>
</table>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
<h1 class=“page-topper”> </h1>
<h1 class=“page-topper”> </h1>
</div>
</div>
<div class=“footer”>
<p class=“copyright”> </p>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>