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 = " SE
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 unsubscrib
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 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
y
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 differe
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,
4: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
ow 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
tain 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
]
-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
; 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
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&quo
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 nu
/
---
-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 wa
ility.
> -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() ...
> h
merce/
---
-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 no
16 matches
Mail list logo