RE: [PHP-DB] Re: output problem
| From: | Chris Grigor | Date: | Fri, 24 May 2002 06:36:13 +0000 |
| Subject: | RE: [PHP-DB] Re: output problem | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19410@lists.php.net to get a copy of this message | ||
ah hah someone got it right !! many thanks stephen ...
-----Original Message-----
From: Stephen Rhodes [mailto:stephen.rhodes@scils.co.uk]
Sent: Thursday, May 23, 2002 8:49 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Re: output problem
When you write the SQL statement write it as:
select count(user) AS count from log_request where date='$date' and
status = 'open'
(note i have added 'AS count' in there so it stores the value in
'count')
Now when you output the result write it as $line->count
Cheers
Steve
"Chris Grigor" <cgrigor@mweb.com> wrote in message
news:6F76E514B4D4EA469DACC8D4E2F2AF9B45DEF1@mwjdc2.mweb.com...
Howdi Alll
some of you might laugh at this but I cant get this to work....
Im doing a count on a field and want to diplay the result here is an
example...
<?php
#error_reporting(E_ALL);
echo date("Y-m-d");
print $date;
mysql_connect("servername", "user", "password")
or die("Connect failed");
$query = "select count(user) from log_request where date='$date' and
status = 'open'";
$result = mysql_db_query("call_manage", "$query")
or die("query failed");
while($line = mysql_fetch_object($result))
{
print ("<table width=100% border=0><td><tr bgcolor=#f0f0f0>");
print ("<br><b> </b>$line->user<br>\n");
print ("</td></tr>");
}
?>
what am I missing as it returns no value at all from $line->user, should I
be
doing this differently??
Thankyou
Chris
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php