thank you for explaining this to me Amit. It works. Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
From: Amit Tandon
Sent: Friday, May 06, 2011 5:49 AM
To: Ron Piggott
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] COUNT and OUTER JOIN results
Dear Ron
Take your condition to ON cluause. So your on clause (for LEFT JOIN) would
read something like
ON `prayer_request_category`.`
reference` = `prayer_requests`.`prayer_request_category_reference`
AND
`prayer_requests`.`approval_
level` IN ( 1, 3 )
`prayer_requests`.`prayer_request_type` =
The following query returns all 8 prayer request categories with the total #
of requests every submitted to each category:
SELECT `prayer_request_category`.`reference` ,
`prayer_request_category`.`category` , COUNT(
`prayer_requests`.`reference` ) AS category_request_count
FROM `prayer_reques
On 13 August 2010 13:43, Ron Piggott wrote:
> SELECT `bible_concordance_words`.`reference`,
> `bible_concordance_words`.`word`,
> COUNT(`bible_concordance_word_reference`.`bible_concordance_words_reference`)
> AS occurrences FROM `bible_concordance_words` INNER JOIN
> `bible_concordance_word_refer
I am making a Bible concordance. I need help with the query that figures
out how many times each word is in the Bible.
The COUNT() in the query below is giving me the total number of words for
the letter of the alphabet, not the specific word, and is causing there to
be only 1 search result.
I h
Hi all
I am 99.9% sure it is my lack of understanding something, but it sure
seems like my PHP/MySQL code is returning something other than what i
expect from reading the docs.
to explain:
this code is serving me (almost perfectly) well:
Thanks for your help, Chris. You certainly got me going in the right
direction. In case anyone is interested, below is the completed
solution, with design elements, turned into a function so I can
easily call it several times.
function counter_maker ($database,$name,$link)
{
Kevin Murphy wrote:
Actually the design is in the code below I need to display the
counts from all of those queries in a grid. Basically, its just a
summary of a bunch of information. Another way to look at it would be a
several lines that say something like this:
You have $data1_count NE
Actually the design is in the code below I need to display the
counts from all of those queries in a grid. Basically, its just a
summary of a bunch of information. Another way to look at it would be
a several lines that say something like this:
You have $data1_count NEW records in data1
> Kevin Murphy asks:
> The following code works and accomplishes what I need it to do, but I
> am wondering if there is a better way to accomplish the same task. I
> have several tables of records and I need to count and then display.
> Even if I could just combine the first three queries (below)
Thanks in advance for your help, and forgive me if this is me being
bone-headed. :-)
The following code works and accomplishes what I need it to do, but I
am wondering if there is a better way to accomplish the same task. I
have several tables of records and I need to count and then display
1
)
) AS unik_visits
FROM T
LEFT JOIN U
ONU.ip = T.ip
AND U.rank = T.rank + 1
GROUP BY ip
HTH
Ignatius
_
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 08, 2004 5:03 PM
Subject: [PHP-D
I am making a PHP/MySQL traffic report page from a table that records some user
activity using PHP referrer information.
I have a table with three rows: IP, page_name, and timestamp. The IP row records the
user's IP address, page_name records the name of the page that the user loaded, and
the t
John,
>That's because you're displaying how many "rows" were returned from the
>query, not the value that COUNT() returns. A query with COUNT() is
>always going to return at least one row.
>
>$visitcount = mysql_result($query,0);
Yes, that was it! Thank you so much.
Lew
--
PHP Database Mailing
Lew Mark-Andrews wrote:
I get a count of 1 for the number of visits
($visitcount) using my following code. It should be 0.
---
code in check_visits.php
$sql = "SELECT COUNT(visitdate) FROM cardlist GROUP BY visitdate";
$query = mysql_query($sql) or die(" Cannot
query the database
On Mon, Dec 22, 2003 at 11:43:35AM +0900, Lew Mark-Andrews wrote:
> Table structure for cardlist:
> `visitdate` datetime default NULL,
> $sql = "SELECT COUNT(visitdate) FROM cardlist GROUP BY visitdate";
> $visitcount = mysql_num_rows($query);
> echo "Total number of visits: $visitcount"; // <
Hi all,
I'm baffled by this. I've put together a rather simple newsletter +
greeting card app for a company to send their clients personalized
corporate e-mails each containing the URL link to the greeting card page.
When the user successfully visits the view card page, my code writes the
visit da
On Mon, 22 Sep 2003, Peter Beckman wrote:
> On Mon, 22 Sep 2003, Frank McIsaac wrote:
>
> > Hi all. I was wanting to make a page that takes a set date and
> > counts down to zero displaying days, minutes, and seconds. Basically, I
> > want it to count down from the current date and time
On Mon, 22 Sep 2003, Frank McIsaac wrote:
> Hi all. I was wanting to make a page that takes a set date and
> counts down to zero displaying days, minutes, and seconds. Basically, I
> want it to count down from the current date and time until a future date
> and time is reached (ie. Sept
Hi all. I was wanting to make a page that takes a set date and
counts down to zero displaying days, minutes, and seconds. Basically, I
want it to count down from the current date and time until a future date
and time is reached (ie. Sept. 30th is x days, y minutes, and z seconds
away fro
Shaun wrote:
Is it possible to combine the COUNT & AVG functions using MySQL? I have a
table called Bookings and I need to find out the average number of bookings.
So I need to count the number of bookings in the table and then get the
Average, is this possible?
Learn SQL, please.
SELECT COUNT(co
Hi,
Is it possible to combine the COUNT & AVG functions using MySQL? I have a
table called Bookings and I need to find out the average number of bookings.
So I need to count the number of bookings in the table and then get the
Average, is this possible?
Thanks for your help
--
PHP Database Mail
Becoming Digital'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, 10 June, 2003 13:14
Subject: RE: [PHP-DB] Count database-values
Edward,
Have you considered trying mysql_result()?
It appears that your query is going to always return a single piece of data:
Total. So
use the index number instead
of the column name as the documentation recommends, the performance should
be just fine.
Hope this helps.
Rich
> -Original Message-
> From: Becoming Digital [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 10, 2003 12:50 PM
> To: [EMAIL PROTECTE
t; <[EMAIL PROTECTED]>
To: "'Becoming Digital'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, 10 June, 2003 11:54
Subject: RE: [PHP-DB] Count database-values
> -Original Message-
> From: Becoming Digital [mailto:[EMAIL PROTECTED]
> Sent: 10
> }
>
> Edward Dudlik
> Becoming Digital
> www.becomingdigital.com
>
>
> - Original Message -
> From: "Becoming Digital" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, 10 June, 2003 06:43
> Subject: Re: [PHP-DB] Count databa
igital
www.becomingdigital.com
- Original Message -
From: "Becoming Digital" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, 10 June, 2003 06:43
Subject: Re: [PHP-DB] Count database-values
> So far no problems, but I want to count all these values.
&g
_array( $result );
$total = $total['Total'];
You had forgotten to pull the data out of your result set. It's a common
mistake. :)
Edward Dudlik
Becoming Digital
www.becomingdigital.com
- Original Message -
From: "Robert Wanadoo" <[EMAIL PROTECTED]>
To: &
Hi everybody,
I've got a little problem, which I can't solve. It is as follow:
In my database I made a table with different fields.
One of the fields is named 'bedrag' and contains a numeric value like 15.47 or 78.16
and so on.
If I want a value of the table I use in most cases the following code
Hi all,
I have this table which stores products and quantities ordered by
customers, and for billing purposes, I need to fetch not only how many
products but also how many where ordered for each one but not detailed,
but as one big result, so later I can charge for individual gift
packages and stu
hello, um using this SQL string :
SELECT computer, date, closedate,UNIX_TIMESTAMP(closedate),
UNIX_TIMESTAMP(date), (UNIX_TIMESTAMP(closedate) -
UNIX_TIMESTAMP(date)) / POW(60,2) FROM tracking (18 Records)
computer date closedate UNIX_TIMESTAMP(closedate) UNIX_TIMESTAMP(date
;Dave Carrera" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 01, 2002 1:02 PM
Subject: [PHP-DB] Count and group ?
Hi All
I have added a row to my table which inputs which admin user has amended
a record in a table on my db.
I have this working but what
48.474.7200 x 183
248.474.8500 (fax)
www.strtrade.com
-Original Message-
From: Dave Carrera [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 8:03 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Count and group ?
Hi All
I have added a row to my table which inputs which admin user has am
Hi All
I have added a row to my table which inputs which admin user has amended
a record in a table on my db.
I have this working but what I would like to do is count how many
instances of the admin id I have stored.
So if my list looks like this..
Admin_id
1
2
2
2
3
3
3
3
;
Sent: Thursday, April 11, 2002 6:52 AM
Subject: RE: [PHP-DB] count
> Something like this
> Select sum(ID) name from $table;
>
> Where name is some name that I come up with?
>
> >Ronald L. Allen (MCSE NT, MCP, CCNA)
> SR. LAN/WAN Administrator
> >SFOR - Hungary, Cro
SELECT SUM(column) as somename FROM table;
Mike
- Original Message -
From: "Ron Allen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 11, 2002 6:52 AM
Subject: [PHP-DB] count
> I would like to count all the total records from a database. How
I would like to count all the total records from a database. How would I go
about doing that???
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
USe the count() function in mysql.
Like this:
$query = "SELECT count(artist) as howmany FROM artist
WHERE artist LIKE
'b%' GROUP BY artist ORDER BY artist
ASC";
$result = mysql_query($query) or die("Select
Failed!");
echo "Total Number Of Artists In
\"B\": ";
echo mysql_num_rows($resul
On Sunday 10 February 2002 00:55, Barry Rumsey wrote:
> I have the following code:
> $query = "SELECT * FROM artist WHERE artist LIKE 'b%' ORDER BY artist
> ASC";
[snip]
> What I would like to know is how do I do a count on each result
> returned.e.g. Benny(4) , Bill(10)
Try:
$query = "SELECT
I have the following code:
$query = "SELECT * FROM artist WHERE artist LIKE 'b%' ORDER BY artist
ASC";
$result = mysql_query($query) or die("Select Failed!");
echo "Total Number Of Artists In \"B\": ";
echo mysql_num_rows($result);
echo "";
if (mysql_num_rows($result)) {
echo "";
echo "Artists";
Afterthought -- you could make this self-maintaining by doing a select for
$PHP_SELF and inserting the record if mysql_num_rows() returned 0. Downside
is that it would add greatly to the overhead.
Miles
At 04:42 PM 1/16/2002 -0400, Miles Thompson wrote:
>Barry,
>
>Before leaping to the wrong c
Barry,
Before leaping to the wrong conclusion, what exactly do you want to count?
You can derive the number of times a page has been fetched from your web logs.
Alternately, you could add a table to your database, and at the top of the
page the link points to, after you've established your da
How do you add a count feature to a link. I can get stuff from the db but want to know
how many times it's been read or click on?
Barry,
I can't see where you've created $topictest.
Maybe, just before you define $queyr2, you should have the line
$topictest = $row[ "topcitext"];
I also think xp_stories_topicid should be xp_stories.topicid
Try echo 'ing $query2 and see what is printed.
Hope this helps, and that I've not m
I'm trying to do the following query:
$db_connect = mysql_connect($sqlhostname,$login,$password);
$base_selection = mysql_select_db($base,$db_connect);
$query = "SELECT DISTINCT * FROM xp_topics WHERE artist_count='artist' AND topictext
LIKE
'A%' ORDER BY artist_count ASC limit 0,5";
Hi,
SELECT SUM(IF(id = '2',1,0)) AS field_name FROM table
Versatile command - you can use it for quite a lot of things.
Barry Rumsey wrote:
> Is it posible to do a count(*) on a tabe where id=2 and count just those that id =
>2
--
--
Dan Barton
Terrestrial Program Biologist
Asst. D
Barry,
Is it posible to do a count(*) on a tabe where id=2 and count just those that id = 2
=why don't you try it?
The answer is yes, because count(*) means count the entire number of non-null rows
selected.
See manual: 3.3.4.8 Counting Rows
=dn
--
PHP Database Mailing List (http://www
Is it posible to do a count(*) on a tabe where id=2 and count just those that id = 2
What is retrieved if you do a Select Count(*) from myDb where
condition = parameters?
Seems your result set should contain this value...
Phil J.
DC wrote:
> Hi All
> I cant quite work out how to count the number of rows in my mysql db that
> match a certain critieria and the show that number n
Cheers Brian
Thats sounds more like i am looking for
Although i have put the other code examples offered for this prob in my code
folder for later cause you never now when you'll need them.
Cheers
Dave C
""Brian S. Dunworth"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAI
At 10:06 AM 3/30/01 -0800, Larry Rivera wrote:
>I think you have to run multiple queries, ie run some loop after finding out
>what topics you wil count from e==>
>
>run a select distinct to get the topics
>run a while or for loop then run queries again like count(*) where
>topic='$topic'
Bette
Thanks i will give that ago.
"Andrei Skorokhod" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> if you just need the number
>
> SELECT COUNT(*) FROM table where
>
> At 06:34 PM 3/30/2001 +0100, DC wrote:
> >Hi All
> >I cant quite work out how t
try mysql_num_rows function
-Original Message-
From: DC [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 30, 2001 9:34 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] count function?
Hi All
I cant quite work out how to count the number of rows in my mysql db that
match a certain critieria and
if you just need the number
SELECT COUNT(*) FROM table where
At 06:34 PM 3/30/2001 +0100, DC wrote:
>Hi All
>I cant quite work out how to count the number of rows in my mysql db that
>match a certain critieria and the show that number numericaly in my pages.
>
>Checked books, ph
al Message-
> From: DC [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 30, 2001 9:53 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] count function?
>
>
> Ok i think i need to expand my help request... my fault
>
> I have a db that uses ids for topics in a m
-Original Message-
From: DC [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 30, 2001 9:53 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] count function?
Ok i think i need to expand my help request... my fault
I have a db that uses ids for topics in a message board ie each topic has
messag
Ok i think i need to expand my help request... my fault
I have a db that uses ids for topics in a message board ie each topic has
messages of various numbers in them.
>From my select a topic page i hope to put the number of messages in the
topic, so it visually looks like this sort of...
to
Hi All
I cant quite work out how to count the number of rows in my mysql db that
match a certain critieria and the show that number numericaly in my pages.
Checked books, php.net etc.
Any help is appreciated
Yours Dave C
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-m
58 matches
Mail list logo