[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 = " SE

[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 unsubscrib

[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);

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 y

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 differe

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,

Re: [PHP-DB] query question

2001-08-28 Thread L Melville
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

RE: [PHP-DB] query question

2001-08-28 Thread Rick Emery
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

Re: [PHP-DB] query question

2001-08-28 Thread L Melville
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

RE: [PHP-DB] query question

2001-08-28 Thread Jon Farmer
] -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

Re: [PHP-DB] query question

2001-08-28 Thread L Melville
; 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

RE: [PHP-DB] query question

2001-08-28 Thread Jon Farmer
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

[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 nu

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

2003-01-10 Thread Matthew Moldvan
/ --- -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

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

2003-01-10 Thread Hutchins, Richard
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

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

2003-01-10 Thread Matthew Moldvan
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