Re: [PHP-DB] Query Question

2011-05-23 Thread maarten
That's a very good point,

but since I use postgres that's one point that doesn't affect me and as
such didn't cross my mind at the time.

(Postgres uses schemas where mysql uses databases, a different database
on postgres usually means a different database machine.  And joining
tables from different database machines isn't really plausible.)

I read the question as 'schema names' in stead of 'database names'.


On Mon, 2011-05-23 at 06:47 -0500, Bret Hughes wrote:
> I like to set the dbname in a config file and use it only for making the 
> connection to the database.  That way I can test/develop against 
> different databases on the same server.  By locking yourself into 
> dbnames in the queries themselves I believe you loose a huge amount of 
> environmental flexibility.
> 
> Using tablenames and or aliases is something I do a fair amount of but 
> only when joining or with complicated queries where clarity is an issue.
> 
> On 05/23/2011 02:20 AM, maarten wrote:
> > I would keep the db names and/or schema names in your queries.
> >
> > It clarifies what you are doing with the query making it easier for
> > someone else to debug, improve, ...  Certainly for those not familiar
> > with your db structure.
> >
> > I am not aware of any drawbacks that can result from this.  (Ok, maybe
> > your program is a few bytes longer?)
> >
> > regards,
> > Maarten
> >
> > On Sun, 2011-05-22 at 05:27 -0400, ad...@buskirkgraphics.com wrote:
> >> I have been working on a class methods for some time now.
> >>
> >>
> >>
> >> I have reached a cross road when it comes to common practice of developing
> >> query structure.
> >>
> >>
> >>
> >> Long ago I wrote queries where I  just called the field I wanted on a
> >> particular table unless I was joining them.
> >>
> >>
> >>
> >> Example:
> >>
> >> $query = " SELECT id FROM Table WHERE Clause";
> >>
> >>
> >>
> >> Through time I developed a habit of queering as such.
> >>
> >> Example:
> >>
> >> $query = "SELECT tablename.id FROM db.table WHERE clause";
> >>
> >>
> >>
> >>
> >>
> >> I have felt that, because my server contains multiple databases and I 
> >> needed
> >> to jump between databases and tables without changing the connector this
> >> always has been best practice for me.
> >>
> >>
> >>
> >> Someone recently told me,
> >>
> >>  Rich,
> >>
> >> I do not agree with your design of the queries.
> >>
> >> There is no need to include the DB and table name in the query if you are
> >> not joining tables.
> >>
> >>
> >>
> >>
> >>
> >> While I have a very hard time understanding this response as being valid. I
> >> will propose the question.
> >>
> >>
> >>
> >>
> >>
> >> Is it bad practice to write queries with the database and table name in the
> >> queries even if I am NOT joining tables?
> >>
> >> Is there an impact from PHP or MySQL that is caused by doing so?
> >>
> >>
> >>
> >> I know this more a MySQL question but as PHP developers we all deal with
> >> queries on a day to day bases,
> >>
> >> and when developing more flexible class methods I build the queries in the
> >> method.
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> Richard L. Buskirk
> >>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Query Question

2011-05-23 Thread maarten
I would keep the db names and/or schema names in your queries.

It clarifies what you are doing with the query making it easier for
someone else to debug, improve, ...  Certainly for those not familiar
with your db structure.

I am not aware of any drawbacks that can result from this.  (Ok, maybe
your program is a few bytes longer?)

regards,
Maarten

On Sun, 2011-05-22 at 05:27 -0400, ad...@buskirkgraphics.com wrote:
> I have been working on a class methods for some time now.
> 
>  
> 
> I have reached a cross road when it comes to common practice of developing
> query structure.
> 
>  
> 
> Long ago I wrote queries where I  just called the field I wanted on a
> particular table unless I was joining them.
> 
>  
> 
> Example:
> 
> $query = " SELECT id FROM Table WHERE Clause";   
> 
>  
> 
> Through time I developed a habit of queering as such.
> 
> Example:
> 
> $query = "SELECT tablename.id FROM db.table WHERE clause";
> 
>  
> 
> 
> 
> I have felt that, because my server contains multiple databases and I needed
> to jump between databases and tables without changing the connector this
> always has been best practice for me.
> 
>  
> 
> Someone recently told me,
> 
> Rich, 
> 
> I do not agree with your design of the queries.
> 
> There is no need to include the DB and table name in the query if you are
> not joining tables.
> 
>  
> 
> 
> 
> While I have a very hard time understanding this response as being valid. I
> will propose the question. 
> 
>  
> 
> 
> 
> Is it bad practice to write queries with the database and table name in the
> queries even if I am NOT joining tables?
> 
> Is there an impact from PHP or MySQL that is caused by doing so?
> 
>  
> 
> I know this more a MySQL question but as PHP developers we all deal with
> queries on a day to day bases, 
> 
> and when developing more flexible class methods I build the queries in the
> method.
> 
>  
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Richard L. Buskirk
> 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Query Question

2011-05-22 Thread admin
I have been working on a class methods for some time now.

 

I have reached a cross road when it comes to common practice of developing
query structure.

 

Long ago I wrote queries where I  just called the field I wanted on a
particular table unless I was joining them.

 

Example:

$query = " SELECT id FROM Table WHERE Clause";   

 

Through time I developed a habit of queering as such.

Example:

$query = "SELECT tablename.id FROM db.table WHERE clause";

 

 

I have felt that, because my server contains multiple databases and I needed
to jump between databases and tables without changing the connector this
always has been best practice for me.

 

Someone recently told me,

Rich, 

I do not agree with your design of the queries.

There is no need to include the DB and table name in the query if you are
not joining tables.

 

 

While I have a very hard time understanding this response as being valid. I
will propose the question. 

 

 

Is it bad practice to write queries with the database and table name in the
queries even if I am NOT joining tables?

Is there an impact from PHP or MySQL that is caused by doing so?

 

I know this more a MySQL question but as PHP developers we all deal with
queries on a day to day bases, 

and when developing more flexible class methods I build the queries in the
method.

 

 

 

 

 

Richard L. Buskirk



[PHP-DB] query question

2003-03-25 Thread 2b4ever php
heyas all,

the database:
KID   MID
1   1
1   2
2   2
I have the following code:

$PID = 1;
$UID = 2;
$res = mysql_query("SELECT KID FROM kpr WHERE MID = '$PID' OR MID = 
'$UID'") or die (mysql_error());

$values = (array_values(mysql_fetch_array($res)));
for ($i=; $i <= count($values); $i++){
print ("($i) $values$i] \n");
}
problem:
If i use option 1 i get the following result:
(0) 1
(1) 1
What i expected was:
(0) 1
(1) 1
(2) 2
anyone knowz why i don't get that result?

TIA

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] QUERY question (group by) - please help

2003-01-10 Thread Matthew Moldvan
Well, I just assumed he was using PHP since this is a PHP list ... :)

Otherwise, he'd have to use SELECT count() FROM ...

Regards,
Matthew Moldvan

---
 System Administrator
 Trilogy International, Inc
 http://www.trilogyintl.com/ecommerce/
---

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 10, 2003 2:07 PM
To: 'Matthew Moldvan'; 'Damir Dezeljin'; PHP-db list
Subject: RE: [PHP-DB] QUERY question (group by) - please help


Just a side note in case it's important, mysql_num_rows() is a PHP function,
not a native MySQL function. Not being nitpicky, but it might be relevant
if, for some reason, Damir cannot use PHP to obtain the number of rows. From
the tone of the original post, it seems that might be a possibility.

> -Original Message-
> From: Matthew Moldvan [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 10, 2003 1:57 PM
> To: 'Damir Dezeljin'; PHP-db list
> Subject: RE: [PHP-DB] QUERY question (group by) - please help
> 
> 
> Try mysql_num_rows() ...
> http://www.php.net/manual/en/function.mysql-num-rows.php for the
> documentation.
> 
> Regards,
> Matthew Moldvan
> 
> ---
>  System Administrator
>  Trilogy International, Inc
>  http://www.trilogyintl.com/ecommerce/
> ---
> 
> -Original Message-
> From: Damir Dezeljin [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 10, 2003 1:01 PM
> To: PHP-db list
> Subject: [PHP-DB] QUERY question (group by) - please help
> 
> 
> Hi.
> 
> Maybe this isn't the correct list for asking the below question (if
> so sorry ;) ).
> 
> I want to calculate how many rows my MySQL query which uses 'GROUP BY'
> returns.
> 
> The query:
> 
> SELECT 
> FROM test
> WHERE (kid=1) OR (kid=2) OR (kid=4)
> GROUP BY cid,aid;
> 
> 
> Is it posible to get number of rows with such a query from 
> MySQL v3.23.49?
> If it isn't posible ... is it posible in MySQL 4.x?
> 
> I think a lot about this problem and I realize only the following
> solution (to avoid returning a lot of rows in PHP):
> CREATE TEMPORARY TABLE t (i INT);
> INSERT INTO t (i) SELECT aid FROM 
> SELECT COUNT(*) FROM t;
> DROP TABLE t;
> 
> But this isn't so elegant.
> 
> I want to do so on data generated by:
> 
> CREATE TABLE test (
> kid INT,
> aid INT,
> cid INT
> );
> 
> INSERT INTO test
> (kid, aid, cid) VALUES
> (  1,   0,   1),
> (  2,   2,   2),
> (  1,   3,   2),
> (  2,   3,   2),
> (  4,   4,   2),
> (  4,   0,   3),
> (  3,   3,   4),
> (  4,   3,   4);
> 
> 
> Regards,
> Dezo
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] QUERY question (group by) - please help

2003-01-10 Thread Hutchins, Richard
Just a side note in case it's important, mysql_num_rows() is a PHP function,
not a native MySQL function. Not being nitpicky, but it might be relevant
if, for some reason, Damir cannot use PHP to obtain the number of rows. From
the tone of the original post, it seems that might be a possibility.

> -Original Message-
> From: Matthew Moldvan [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 10, 2003 1:57 PM
> To: 'Damir Dezeljin'; PHP-db list
> Subject: RE: [PHP-DB] QUERY question (group by) - please help
> 
> 
> Try mysql_num_rows() ...
> http://www.php.net/manual/en/function.mysql-num-rows.php for the
> documentation.
> 
> Regards,
> Matthew Moldvan
> 
> ---
>  System Administrator
>  Trilogy International, Inc
>  http://www.trilogyintl.com/ecommerce/
> ---
> 
> -Original Message-
> From: Damir Dezeljin [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 10, 2003 1:01 PM
> To: PHP-db list
> Subject: [PHP-DB] QUERY question (group by) - please help
> 
> 
> Hi.
> 
> Maybe this isn't the correct list for asking the below question (if
> so sorry ;) ).
> 
> I want to calculate how many rows my MySQL query which uses 'GROUP BY'
> returns.
> 
> The query:
> 
> SELECT 
> FROM test
> WHERE (kid=1) OR (kid=2) OR (kid=4)
> GROUP BY cid,aid;
> 
> 
> Is it posible to get number of rows with such a query from 
> MySQL v3.23.49?
> If it isn't posible ... is it posible in MySQL 4.x?
> 
> I think a lot about this problem and I realize only the following
> solution (to avoid returning a lot of rows in PHP):
> CREATE TEMPORARY TABLE t (i INT);
> INSERT INTO t (i) SELECT aid FROM 
> SELECT COUNT(*) FROM t;
> DROP TABLE t;
> 
> But this isn't so elegant.
> 
> I want to do so on data generated by:
> 
> CREATE TABLE test (
> kid INT,
> aid INT,
> cid INT
> );
> 
> INSERT INTO test
> (kid, aid, cid) VALUES
> (  1,   0,   1),
> (  2,   2,   2),
> (  1,   3,   2),
> (  2,   3,   2),
> (  4,   4,   2),
> (  4,   0,   3),
> (  3,   3,   4),
> (  4,   3,   4);
> 
> 
> Regards,
> Dezo
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] QUERY question (group by) - please help

2003-01-10 Thread Matthew Moldvan
Try mysql_num_rows() ...
http://www.php.net/manual/en/function.mysql-num-rows.php for the
documentation.

Regards,
Matthew Moldvan

---
 System Administrator
 Trilogy International, Inc
 http://www.trilogyintl.com/ecommerce/
---

-Original Message-
From: Damir Dezeljin [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 10, 2003 1:01 PM
To: PHP-db list
Subject: [PHP-DB] QUERY question (group by) - please help


Hi.

Maybe this isn't the correct list for asking the below question (if
so sorry ;) ).

I want to calculate how many rows my MySQL query which uses 'GROUP BY'
returns.

The query:

SELECT 
FROM test
WHERE (kid=1) OR (kid=2) OR (kid=4)
GROUP BY cid,aid;


Is it posible to get number of rows with such a query from MySQL v3.23.49?
If it isn't posible ... is it posible in MySQL 4.x?

I think a lot about this problem and I realize only the following
solution (to avoid returning a lot of rows in PHP):
CREATE TEMPORARY TABLE t (i INT);
INSERT INTO t (i) SELECT aid FROM 
SELECT COUNT(*) FROM t;
DROP TABLE t;

But this isn't so elegant.

I want to do so on data generated by:

CREATE TABLE test (
kid INT,
aid INT,
cid INT
);

INSERT INTO test
(kid, aid, cid) VALUES
(  1,   0,   1),
(  2,   2,   2),
(  1,   3,   2),
(  2,   3,   2),
(  4,   4,   2),
(  4,   0,   3),
(  3,   3,   4),
(  4,   3,   4);


Regards,
Dezo



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] QUERY question (group by) - please help

2003-01-10 Thread Damir Dezeljin
Hi.

Maybe this isn't the correct list for asking the below question (if
so sorry ;) ).

I want to calculate how many rows my MySQL query which uses 'GROUP BY'
returns.

The query:

SELECT 
FROM test
WHERE (kid=1) OR (kid=2) OR (kid=4)
GROUP BY cid,aid;


Is it posible to get number of rows with such a query from MySQL v3.23.49?
If it isn't posible ... is it posible in MySQL 4.x?

I think a lot about this problem and I realize only the following
solution (to avoid returning a lot of rows in PHP):
CREATE TEMPORARY TABLE t (i INT);
INSERT INTO t (i) SELECT aid FROM 
SELECT COUNT(*) FROM t;
DROP TABLE t;

But this isn't so elegant.

I want to do so on data generated by:

CREATE TABLE test (
kid INT,
aid INT,
cid INT
);

INSERT INTO test
(kid, aid, cid) VALUES
(  1,   0,   1),
(  2,   2,   2),
(  1,   3,   2),
(  2,   3,   2),
(  4,   4,   2),
(  4,   0,   3),
(  3,   3,   4),
(  4,   3,   4);


Regards,
Dezo



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] query question

2001-08-28 Thread Jon Farmer

See

http://www.php.net/manual/en/ref.array.php

You will need a multi-dimensional array if your resultset has more than one
field

Regards

Jon

--
Jon Farmer  տլ
Systems Programmer, Entanet www.enta.net
Tel +44 (0)1952 428969 Mob +44 (0)7968 524175
PGP Key available, send blank email to [EMAIL PROTECTED]

-Original Message-
From: L Melville [mailto:[EMAIL PROTECTED]]
Sent: 28 August 2001 14:54
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] query question


yeh this would work, how can I assign the rows to a new array? Is each row
accessed as an element?


"Jon Farmer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> The only way i could think of doing this is to loop through $result and
> assign the rows you want to keep to a new array.
>
>
>
> --
> Jon Farmer  տլ
> Systems Programmer, Entanet www.enta.net
> Tel +44 (0)1952 428969 Mob +44 (0)7968 524175
> PGP Key available, send blank email to [EMAIL PROTECTED]
>
> -Original Message-
> From: L Melville [mailto:[EMAIL PROTECTED]]
> Sent: 28 August 2001 14:41
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] query question
>
>
> I want to loop round $result fetching rows and if the current row is not
> needed then removing it from $result, $result will then get used again but
> with the said rows removed.  I am trying to do this to avoid some major
code
> changes with what I am working with.
>
>
> "Rick Emery" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > What exactly are you trying to do?  Do you want to delete certain rows
> from
> > $result?  Or delete ALL rows, in which you'd use:
> > mysql_return_result($result);
> >
> > If you want to delete certain rows, you can't.  You just have to make
your
> > selection criteria more precise.  Then, fetch row by row to weed out
those
> > rows you do not want.
> >
> > rick
> > -Original Message-
> > From: L Melville [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, August 28, 2001 8:21 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] query question
> >
> >
> > Hi,
> >
> > If I run a query;-
> >
> > $result = mysql_query($query);
> >
> > is there a way of deleting rows from $result after this runs.  Or does
> > anyone have any idea of how $result is generally structured when
> > mysql_query($query) is run.
> >
> > thanks
> >
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] query question

2001-08-28 Thread L Melville

yeh this would work, how can I assign the rows to a new array? Is each row
accessed as an element?


"Jon Farmer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> The only way i could think of doing this is to loop through $result and
> assign the rows you want to keep to a new array.
>
>
>
> --
> Jon Farmer  տլ
> Systems Programmer, Entanet www.enta.net
> Tel +44 (0)1952 428969 Mob +44 (0)7968 524175
> PGP Key available, send blank email to [EMAIL PROTECTED]
>
> -Original Message-
> From: L Melville [mailto:[EMAIL PROTECTED]]
> Sent: 28 August 2001 14:41
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] query question
>
>
> I want to loop round $result fetching rows and if the current row is not
> needed then removing it from $result, $result will then get used again but
> with the said rows removed.  I am trying to do this to avoid some major
code
> changes with what I am working with.
>
>
> "Rick Emery" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > What exactly are you trying to do?  Do you want to delete certain rows
> from
> > $result?  Or delete ALL rows, in which you'd use:
> > mysql_return_result($result);
> >
> > If you want to delete certain rows, you can't.  You just have to make
your
> > selection criteria more precise.  Then, fetch row by row to weed out
those
> > rows you do not want.
> >
> > rick
> > -Original Message-
> > From: L Melville [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, August 28, 2001 8:21 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] query question
> >
> >
> > Hi,
> >
> > If I run a query;-
> >
> > $result = mysql_query($query);
> >
> > is there a way of deleting rows from $result after this runs.  Or does
> > anyone have any idea of how $result is generally structured when
> > mysql_query($query) is run.
> >
> > thanks
> >
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] query question

2001-08-28 Thread Jon Farmer

The only way i could think of doing this is to loop through $result and
assign the rows you want to keep to a new array.



--
Jon Farmer  տլ
Systems Programmer, Entanet www.enta.net
Tel +44 (0)1952 428969 Mob +44 (0)7968 524175
PGP Key available, send blank email to [EMAIL PROTECTED]

-Original Message-
From: L Melville [mailto:[EMAIL PROTECTED]]
Sent: 28 August 2001 14:41
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] query question


I want to loop round $result fetching rows and if the current row is not
needed then removing it from $result, $result will then get used again but
with the said rows removed.  I am trying to do this to avoid some major code
changes with what I am working with.


"Rick Emery" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> What exactly are you trying to do?  Do you want to delete certain rows
from
> $result?  Or delete ALL rows, in which you'd use:
> mysql_return_result($result);
>
> If you want to delete certain rows, you can't.  You just have to make your
> selection criteria more precise.  Then, fetch row by row to weed out those
> rows you do not want.
>
> rick
> -Original Message-
> From: L Melville [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 28, 2001 8:21 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] query question
>
>
> Hi,
>
> If I run a query;-
>
> $result = mysql_query($query);
>
> is there a way of deleting rows from $result after this runs.  Or does
> anyone have any idea of how $result is generally structured when
> mysql_query($query) is run.
>
> thanks
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] query question

2001-08-28 Thread L Melville

I want to loop round $result fetching rows and if the current row is not
needed then removing it from $result, $result will then get used again but
with the said rows removed.  I am trying to do this to avoid some major code
changes with what I am working with.


"Rick Emery" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> What exactly are you trying to do?  Do you want to delete certain rows
from
> $result?  Or delete ALL rows, in which you'd use:
> mysql_return_result($result);
>
> If you want to delete certain rows, you can't.  You just have to make your
> selection criteria more precise.  Then, fetch row by row to weed out those
> rows you do not want.
>
> rick
> -Original Message-
> From: L Melville [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 28, 2001 8:21 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] query question
>
>
> Hi,
>
> If I run a query;-
>
> $result = mysql_query($query);
>
> is there a way of deleting rows from $result after this runs.  Or does
> anyone have any idea of how $result is generally structured when
> mysql_query($query) is run.
>
> thanks
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] query question

2001-08-28 Thread Rick Emery

What exactly are you trying to do?  Do you want to delete certain rows from
$result?  Or delete ALL rows, in which you'd use:
mysql_return_result($result);

If you want to delete certain rows, you can't.  You just have to make your
selection criteria more precise.  Then, fetch row by row to weed out those
rows you do not want.

rick
-Original Message-
From: L Melville [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 28, 2001 8:21 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] query question


Hi,

If I run a query;-

$result = mysql_query($query);

is there a way of deleting rows from $result after this runs.  Or does
anyone have any idea of how $result is generally structured when
mysql_query($query) is run.

thanks




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] query question

2001-08-28 Thread L Melville

sorry I wasn't very clear,  I do not actually want to delete anything from
the database, I need to remove some of the query elements before it is used
elsewhere (before fetch array ect), but I cannot alter the way the select
query works.



"Dave Watkinson" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
instead of SELECT all_records WHERE some_condition, and then DELETE
certain_rows, couldn't you just do a DELETE FROM WHERE?


-Original Message-
From: L Melville [mailto:[EMAIL PROTECTED]]
Sent: 28 August 2001 14:21
To: [EMAIL PROTECTED]
Subject: [PHP-DB] query question


Hi,

If I run a query;-

$result = mysql_query($query);

is there a way of deleting rows from $result after this runs.  Or does
anyone have any idea of how $result is generally structured when
mysql_query($query) is run.

thanks




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]








-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] query question

2001-08-28 Thread Dave Watkinson

instead of SELECT all_records WHERE some_condition, and then DELETE
certain_rows, couldn't you just do a DELETE FROM WHERE?


-Original Message-
From: L Melville [mailto:[EMAIL PROTECTED]]
Sent: 28 August 2001 14:21
To: [EMAIL PROTECTED]
Subject: [PHP-DB] query question


Hi,

If I run a query;-

$result = mysql_query($query);

is there a way of deleting rows from $result after this runs.  Or does
anyone have any idea of how $result is generally structured when
mysql_query($query) is run.

thanks




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] query question

2001-08-28 Thread L Melville

Hi,

If I run a query;-

$result = mysql_query($query);

is there a way of deleting rows from $result after this runs.  Or does
anyone have any idea of how $result is generally structured when
mysql_query($query) is run.

thanks




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]