?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?take a look at this...
Author:??(203.177.42.---)
Date:???05-04-04 23:38


we want to display the total hours work of a person from the database. and we used the following codes:

$link=mysql_connect("localhost","root","passW0rd.")
or die("You are not connected");
mysql_select_db("ojt");

$sql='select SUM(No_Hours) from timelist where="'.$id.'"';
$result=mysql_query($sql,$link);

echo 'Total hours work:'.$result.'';


why is it this statement won't work?
is something missing?
instead of the total hours be dispalayed, this statement will
be displayed: "resource id #5", that supposed to be the value
of $result will be displayed...

do help us...:)

?Re: take a look at this...
Author:??(---.scpe.powergate.ca)
Date:???05-05-04 05:30

$result is not the result of the query, its the resource link to the tranasction that produces the output...change your code to:

$sql='select SUM(No_Hours) AS HOURS from timelist where="'.$id.'"';
$result=mysql_query($sql,$link);

$while ($rows=mysql_fetch_array($result)){
echo 'Total hours work:'.$rows['HOURS'].'.';
}

Go to Top??|??Go to Topic??|??Threaded View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??

Provided By
Phorum