ctcp Posted July 25, 2011 Share Posted July 25, 2011 <?php require_once('hlios.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; } } $colname_test = "-1"; if (isset($_GET['id'])) { $colname_test = $_GET['id']; } mysql_select_db($database_hlios, $hlios); $query_test = sprintf("SELECT * FROM carpets_1 WHERE id = %s", GetSQLValueString($colname_test, "int")); $test = mysql_query($query_test, $hlios) or die(mysql_error()); $row_test = mysql_fetch_assoc($test); $totalRows_test = mysql_num_rows($test); ?> <?php echo $row_test['platos']; ?> <p>+</p> <p><?php echo $row_test['mhkos']; ?> <? mysql_free_result($test); ?> how to sum <?php echo $row_test['platos']; ?>+ <?php echo $row_test['mhkos']; ?>= thank you for help Quote Link to comment https://forums.phpfreaks.com/topic/242725-how-to-sum-php-mysql/ Share on other sites More sharing options...
wildteen88 Posted July 25, 2011 Share Posted July 25, 2011 This what you mean <p><?php echo $row_test['platos']; ?> + <?php echo $row_test['mhkos']; ?> = <?php echo $row_test['platos'] + $row_test['mhkos']; ?></p> Quote Link to comment https://forums.phpfreaks.com/topic/242725-how-to-sum-php-mysql/#findComment-1246682 Share on other sites More sharing options...
ctcp Posted July 25, 2011 Author Share Posted July 25, 2011 so simple thank you mate Quote Link to comment https://forums.phpfreaks.com/topic/242725-how-to-sum-php-mysql/#findComment-1246686 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.