
August 20th, 2002, 09:10 PM
|
|
Registered User
|
|
Join Date: Apr 2007
Posts: 22,309
Time spent in forums: < 1 sec
Reputation Power: 24
|
|
|
SQL-query
I have my querry reading correctly form mysql,
SELECT SUM(hours) AS Total FROM pirep where pilotid LIKE 'KVA001'
problem 1, i would like to select sum hours from one given pilotid, and "where pilotid LIKE 'pilotid" returns a NULL value.
problem 2: I am new so dont laugh at this, my php code to bring up the data looks like this:
<?php
mysql_connect (xxxx, xxxx, xxxx);
mysql_select_db (xxxx);
if ($pilotid == "")
{$pilotid = '%';}
$result = mysql_query ("SELECT * SUM(hours) AS Total FROM pirep where pilotid LIKE '$pilotid%'");
if ($row = mysql_fetch_array($result)) {
do {
print "<td>{$row['hours']}</TD>n";
?>
that doesnt work. any ideas????
|