Search found 7 matches

by syntax406
Wed Mar 10, 2004 2:52 pm
Forum: PHP - Code
Topic: Average Function
Replies: 8
Views: 664

Once again, thank you immensely for your help!
by syntax406
Tue Mar 09, 2004 10:25 pm
Forum: PHP - Code
Topic: Average Function
Replies: 8
Views: 664

Worked, Thank you very much!!! :D
by syntax406
Tue Mar 09, 2004 9:47 pm
Forum: PHP - Code
Topic: Average Function
Replies: 8
Views: 664

Ok, so I changed SUM to AVG

Code: Select all

<?php 
$field1 = mysql_query("SELECT AVG(fieldname) FROM survey_scores"); 
echo "$field1"; 
?>
Now it returns "Resource id #2".
How can I set it to display the numerical average?
by syntax406
Tue Mar 09, 2004 9:09 pm
Forum: PHP - Code
Topic: Average Function
Replies: 8
Views: 664

I'm sorry, I don't mean to be an idiot or anything, but could you please be a bit more specific?
by syntax406
Tue Mar 09, 2004 6:03 pm
Forum: PHP - Code
Topic: Average Function
Replies: 8
Views: 664

Average Function

Am am trying to find the average of several fields in a mysql db. I am using this code: <?php $result = mysql_query("SELECT * FROM database",$db); $num_rows = mysql_num_rows($result); $field1 = mysql_query("SELECT SUM(fieldname) FROM database",$db); $var1 = $field1 / $num_rows; e...
by syntax406
Tue Mar 02, 2004 3:24 pm
Forum: PHP - Code
Topic: Remote ip function
Replies: 4
Views: 467

Remote IP function

I had a fealing that was the case, but I just needed to make sure, thanks for your're help!!
by syntax406
Mon Mar 01, 2004 3:57 pm
Forum: PHP - Code
Topic: Remote ip function
Replies: 4
Views: 467

Remote ip function

I am working on a survey that utilizes a mysql db and am using the useres ip address as the line validator in the database, however, I have noticed that, in conditions like an ADSL connection, the function '$remote_addr' will read the ip off of the router and not the ip from the computer itself. I h...