[PHP-DB] mysql COUNT row results

2011-06-22 Thread Ron Piggott
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

Re: [PHP-DB] Re: COUNT() returns 0 if there were no matching rows. .... really?!

2009-08-06 Thread Govinda
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

[PHP-DB] Updating count on record results

2004-11-19 Thread Stuart Felenstein
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

RE: [PHP-DB] Updating count on record results

2004-11-19 Thread Bastien Koert
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

RE: [PHP-DB] Updating count on record results

2004-11-19 Thread Stuart Felenstein
--- 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

RE: [PHP-DB] Updating count on record results

2004-11-19 Thread Bastien Koert
: [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

[PHP-DB] Re: Count unique visits in PHP/MySQL

2004-06-10 Thread Rui Cunha
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

[PHP-DB] Re: Count unique visits in PHP/MySQL

2004-06-09 Thread Kim Steinhaug
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

[PHP-DB] Row count in a query

2004-01-31 Thread Shaun
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,

Re: [PHP-DB] Row count in a query

2004-01-31 Thread Ignatius Reilly
_ - 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

Re: [PHP-DB] Row count in a query

2004-01-31 Thread John W. Holmes
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

Re: [PHP-DB] Row count in a query

2004-01-31 Thread Martn Marqus
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

Re: [PHP-DB] Row count in a query

2004-01-31 Thread Ignatius Reilly
[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

Re: [PHP-DB] Row count in a query

2004-01-31 Thread John W. Holmes
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

Re: [PHP-DB] SELECT COUNT - result from two tables

2003-11-06 Thread CPT John W. Holmes
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

[PHP-DB] SELECT COUNT - result from two tables

2003-11-05 Thread Mark Gordon
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,

Re: [PHP-DB] SELECT COUNT - result from two tables

2003-11-05 Thread John W. Holmes
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(*),

Re: [PHP-DB] SELECT COUNT - result from two tables

2003-11-05 Thread Mark Gordon
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

Re: [PHP-DB] SELECT COUNT - result from two tables

2003-11-05 Thread John W. Holmes
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

[PHP-DB] SQL COUNT vs mysql_num_rows

2003-11-05 Thread [EMAIL PROTECTED]
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

Re: [PHP-DB] SELECT COUNT - result from two tables

2003-11-05 Thread Boyan Nedkov
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)

Re: [PHP-DB] SQL COUNT vs mysql_num_rows

2003-11-05 Thread Boyan Nedkov
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

[PHP-DB] SELECT Count - solved

2003-11-05 Thread [EMAIL PROTECTED]
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

[PHP-DB] Column count error?

2002-07-26 Thread Jas
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 *

Re: [PHP-DB] Column count error?

2002-07-26 Thread Gurhan Ozen
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

[PHP-DB] Word Count, rounding and missing zeros

2002-05-12 Thread Kim Kohen
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

[PHP-DB] Re: count

2002-04-11 Thread Ron Allen
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]

[PHP-DB] Re: count

2002-04-11 Thread David Robley
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

[PHP-DB] Re: count

2002-04-11 Thread Ron Allen
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

[PHP-DB] Re: count

2002-04-11 Thread David Robley
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

Re: [PHP-DB] a Count() ?

2002-03-16 Thread Andrey Hristov
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

Re: [PHP-DB] a Count() ?

2002-03-16 Thread DL Neil
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

Re: [PHP-DB] a Count() ?

2002-03-16 Thread Pierre-Alain Joye
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

Re: [PHP-DB] a Count() ?

2002-03-16 Thread Pierre-Alain Joye
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,

[PHP-DB] Difficult count statement. Need some sql advice

2002-03-02 Thread Andy
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

Re: [PHP-DB] Difficult count statement. Need some sql advice

2002-03-02 Thread Bill Morrow
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

[PHP-DB] Re: count from the results

2002-02-09 Thread Raymond Lilleodegard
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

[PHP-DB] Re: Count(*)

2002-01-24 Thread Barry Rumsey
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(*)