Is there a way that
SELECT COUNT(auto_increment) as total_subscribers , `email` FROM `table`
may exist within the same query and provide more than 1 row of search results?
When I run a query like this the COUNT portion of the result is allowing only 1
to be selected. My desire is to have
Here's an example (snip) from a var_dump of that
$BuildPerUniqueDateArray:
(note that the 'aweber_7solar_aw' table does NOT have a record for
the
date '2009-07-28', so I would expect to see that 1 to be a 0
there.)
If a table doesn't have a record for a given date, I wouldn't expect
to
I am setting up a table to log a count on individual
records for every time they are returned in a results
return.
Just so to illustrate
Record1
First search brings up Record1 (counter is set too 1)
Second search brings up Record1 (counter is set too 2)
Third search brings up Record1 (counter
this is how I did it for a client's site
// update the number of times the vehicle has been viewed
mysql_db_query($dbname, UPDATE vehicle_inventory SET viewed=viewed+1 WHERE
ccode='$ccode', $link);
bastien
From: Stuart Felenstein [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Updating
--- Bastien Koert [EMAIL PROTECTED] wrote:
this is how I did it for a client's site
// update the number of times the vehicle has been
viewed
mysql_db_query($dbname, UPDATE vehicle_inventory
SET viewed=viewed+1 WHERE
ccode='$ccode', $link);
Where did this code go though ? Meaning, was
: [PHP-DB] Updating count on record results
Date: Fri, 19 Nov 2004 07:28:48 -0800 (PST)
--- Bastien Koert [EMAIL PROTECTED] wrote:
this is how I did it for a client's site
// update the number of times the vehicle has been
viewed
mysql_db_query($dbname, UPDATE vehicle_inventory
SET viewed=viewed+1
take a look at this:
http://otn.oracle.com/oramag/oracle/04-mar/o24asktom.html
and search for the Analytics to the Rescue example. Instead of 3 seconds
you want 1800 and instead of sum you want count.Don't forget to group by
ip,of course... And you're done. No need for an extra table.
Hope
Whatabout creating a table containing online users,
where you log every activity with IP, BrowserSession and Timestamp.
You also create a table to track the accual unique visits.
So my logic to solve it :
Update the online table like this (Some rough coding below, not tested at
all, read the
Hi,
Is it possible to have an incrementing row count in my query that is not
part of the table data?
i.e.
1 data data
2 data data
3 data data
...
This has to be done in the query not the PHP!!
Thanks for your help
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe,
_
- Original Message -
From: Shaun [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, January 31, 2004 11:44
Subject: [PHP-DB] Row count in a query
Hi,
Is it possible to have an incrementing row count in my query that is not
part of the table data?
i.e.
1 data data
2 data data
3 data
Shaun wrote:
Is it possible to have an incrementing row count in my query that is not
part of the table data?
i.e.
1 data data
2 data data
3 data data
...
This has to be done in the query not the PHP!!
If you _have_ to get this in your query I'd say you have a flaw in your
logic
El Dom 01 Feb 2004 12:54, John W. Holmes escribi:
Shaun wrote:
Is it possible to have an incrementing row count in my query that is not
part of the table data?
i.e.
1 data data
2 data data
3 data data
...
This has to be done in the query not the PHP!!
If you
[EMAIL PROTECTED]
To: [EMAIL PROTECTED]; Shaun [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, January 31, 2004 18:00
Subject: Re: [PHP-DB] Row count in a query
El Dom 01 Feb 2004 12:54, John W. Holmes escribi:
Shaun wrote:
Is it possible to have an incrementing row count in my query
Martn Marqus wrote:
El Dom 01 Feb 2004 12:54, John W. Holmes escribi:
Shaun wrote:
Is it possible to have an incrementing row count in my query that is not
part of the table data?
If you _have_ to get this in your query I'd say you have a flaw in your
logic somewhere. However, you can do it in
From: Boyan Nedkov [EMAIL PROTECTED]
Putting more than one table in the FROM clause means tables are joined,
then at least following problems could arise:
- using WHERE clause you can have empty recordset returned and then
COUNT conflicts with it because there is actually no any data to be
I cannot seem to get a SELECT COUNT for a query from fields in two different tables
and a WHERE clause. Does anyone know if this is not possible with php/mysql or am I
doing something wrong? I have tried a number of variations on the following code:
$sql = SELECT COUNT(*), bandid, bandname,
Mark Gordon wrote:
I cannot seem to get a SELECT COUNT for a query from fields in two different tables and a WHERE clause. Does anyone know if this is not possible with php/mysql or am I doing something wrong? I have tried a number of variations on the following code:
$sql = SELECT COUNT(*),
Yes, query is definitely working without COUNT(*). Even in the most stripped down
form, the query fails:
$sql = SELECT COUNT(bandid), genre
FROM bands, genre;
$result=mysql_query($sql);
while ($gen=mysql_fetch_row($result)) {
echo $gen[1];
}
John W. Holmes [EMAIL PROTECTED] wrote:
Mark Gordon
Mark Gordon wrote:
Yes, query is definitely working without COUNT(*). Even in the most stripped down form, the query fails:
$sql = SELECT COUNT(bandid), genre
FROM bands, genre;
$result=mysql_query($sql);
while ($gen=mysql_fetch_row($result)) {
echo $gen[1];
}
Fails how? If it echos zero, it's
maybe mysql cannot COUNT the result from more than 1 table, hence the mysql_num_rows
function - but isn't it good programming practice to get the SQL to do as much work up
front?
-
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
Putting more than one table in the FROM clause means tables are joined,
then at least following problems could arise:
- using WHERE clause you can have empty recordset returned and then
COUNT conflicts with it because there is actually no any data to be
returned;
- joining two (or more)
if tables are joined correctly it shouldn't be any problem to get count
of a column, and yes - delegating that task to the database should be
more efficient concerning the execution time
boyan
--
[EMAIL PROTECTED] wrote:
maybe mysql cannot COUNT the result from more than 1 table, hence the
Thanks for the debug advice - I will start using my_sql_error
First I got this error:
Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if
there is no GROUP BY clause
So the correct code ended up:
$sql = SELECT COUNT(bandid), genre
FROM bands, genre
GROUP BY
I am not sure how to resolve this type of error, any help is appreciated.
TIA
Jas
/* Error message */
Column count doesn't match value count at row 1
/* Code to query db for username and password */
require '/home/bignickel.net/scripts/admin/db.php';
$db_table = 'auth_users';
$sql = SELECT *
Did you copy and paste the code?
There is no such function as mysql_numrows, it has to be mysql_num_rows.. I
don't know why you didn't get an error for it?
Gurhan
Jas [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I am not sure how to resolve this type of
G'day All,
I'm using php to query a mysql db and I need to display a word count from
one of the columns and multiply it to get a quote.
So far I have this:
$thewords = count(split ( ,$adtext));
$thequote = round(($thewords * .78),2);
In an example with 35 words it returns 27.3 but I'd like it
I know how to get the results for the total number of records
select count(*) from $table
but how do I put them into a variable for me to use later???
David Robley [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
In article [EMAIL PROTECTED],
[EMAIL PROTECTED]
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] says...
I know how to get the results for the total number of records
select count(*) from $table
but how do I put them into a variable for me to use later???
David Robley [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL
What is the Aliases used for???
Aliases. SELECT COUNT(*) AS howmany FROM table
Then use the variable $howmany
--
David Robley
Temporary Kiwi!
Quod subigo farinam
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] says...
What is the Aliases used for???
Aliases. SELECT COUNT(*) AS howmany FROM table
Then use the variable $howmany
At this stage I refer you to The Fine (mysql) Manual - or anything on the
SQL language.
--
David Robley
Temporary
select cat_id, count(prod_id) from some_table order by cat_id;
Best regards,
Andrey Hristov
- Original Message -
From: Dave Carrera [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, March 16, 2002 12:46 PM
Subject: [PHP-DB] a Count() ?
Hi All
I am trying to count how many
Hi Dave,
I am trying to count how many product names in my db have the same
category id and then show it ie:
Catid 1 Product 1
Catid 1 Product 2
Catid 2 Product 3
Catid 3 Product 4
Catid 3 Product 5
Result would be
Catid1 has 2 products
Catid2 has 1 products
Catid3 has 2 products
On Sat, 16 Mar 2002 10:46:38 -
Dave Carrera [EMAIL PROTECTED] wrote:
Hi All
I am trying to count how many product names in my db have the same
category id and then show it ie:
Catid 1 Product 1
Catid 1 Product 2
Catid 2 Product 3
Catid 3 Product 4
Catid 3 Product 5
Result
On Sat, 16 Mar 2002 11:50:11 -
DL Neil [EMAIL PROTECTED] wrote:
Hi Dave,
SELECT * FROM tblNm;
SELECT * FROM tblNm GROUP BY Catid1;
SELECT Catid1, count(*) FROM tblNm GROUP BY Catid1;
As I said 'follow your instincts' and take it one step at a time: Code
the simplest query first,
Hi there,
I would like to querry my db for following result
- Count the number of topics listed in the table fo_topics,
but only the topics where the belonging forum is not in the archive mode
( this is when table fo_forums field archive is 1)
I tryed following querry but this is for sure
On Sat, Mar 02, 2002 at 05:36:41PM +0100, Andy wrote:
Hi there,
I would like to querry my db for following result
- Count the number of topics listed in the table fo_topics,
but only the topics where the belonging forum is not in the archive mode
( this is when table fo_forums field
Hi Barry!
you can do it like this for example:
$query = SELECT * FROM artist WHERE artist_name LIKE 'b%' ORDER BY artist
ASC;
$count = mysql_query(SELECT COUNT(artist) AS count FROM artist WHERE
artist_name LIKE 'b%',$db);
$x = mysql_fetch_array($count);
$result = mysql_query($query) or
Thank you everyone. The "COUNT(*) AS c" worked great.
---Original Message---
From: Kai Voigt
Date: Friday, 25
January 2002 11:11:06 a.
To: Barry Rumsey
Cc: [EMAIL PROTECTED]
Subject: Re:
Count(*)
38 matches
Mail list logo