How to print the result of the query in php -


i new php, want print response of query, getting records database , calculating average , want echo average average (column). below query. can 1 me please?

select avg(client_workout_length) client_workout month(client_date_of_workout)=04 , client_id=2;

thanks in advance!

your try although mysql deprecated , shouldn't use can use mysqli http://www.php.net/manual/en/book.mysqli.php or pdo http://php.net/manual/en/book.pdo.php

<?php  $query = "select avg(client_workout_length) average_workout_per_month client_workout month(client_date_of_workout)=".$month." , client_id=".$clientid." ";   $result = mysql_query($query); if (!$result) { echo 'could not run query: ' . mysql_error(); exit; } $row = mysql_fetch_row($result);  echo "<pre>"; print_r($row); echo "</pre>";  ?> 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -