Re: SQL Table Rows

2002-10-01 Thread Gary Stainburn
On Tuesday 01 Oct 2002 2:53 am, Hengky wrote: How is it possible to cycle through an SQL table row by row, without having to increment an ID by 1 in a while loop and go SELECT * FROM table WHERE id=$id ? And how can I find out how many rows are in the table? i hope this one can

Re: SQL Table Rows

2002-10-01 Thread Felix Geerinckx
on Tue, 01 Oct 2002 10:50:26 GMT, [EMAIL PROTECTED] (Gary Stainburn) wrote: Nobody's mentioned: $countrow=$sth-rows; This way is more efficient that doing the 'select count(*)' as it's done from the same select query, and it also means that yo know beforehand how many rows you will be

Re: SQL Table Rows

2002-10-01 Thread Gary Stainburn
On Tuesday 01 Oct 2002 12:14 pm, Felix Geerinckx wrote: on Tue, 01 Oct 2002 10:50:26 GMT, [EMAIL PROTECTED] (Gary Stainburn) wrote: Nobody's mentioned: $countrow=$sth-rows; This way is more efficient that doing the 'select count(*)' as it's done from the same select query, and it

Re: SQL Table Rows

2002-10-01 Thread dan
8a8daed0$3864a8c0@comice... -Original Message- From: dan [mailto:[EMAIL PROTECTED]] Sent: 30 September 2002 13:55 To: [EMAIL PROTECTED] Subject: Re: SQL Table Rows snip __ START __ $id = 1; $sth = $dbh-prepare(SELECT * FROM table WHERE id=$id); $sth-execute; @ar

SQL Table Rows

2002-09-30 Thread dan
How is it possible to cycle through an SQL table row by row, without having to increment an ID by 1 in a while loop and go SELECT * FROM table WHERE id=$id ? And how can I find out how many rows are in the table? Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: SQL Table Rows

2002-09-30 Thread Cleiton L. Siqueira
Dear Dan, I don't know if I understood what you really want. Therefore I will try to help, ok. I use Postgres as Database. You can find out how many rows have in a table after you run a SQL like this. #!/usr/bin/perl use Pg; $db= Pg::connectdb(dbname=database); # This

Re: SQL Table Rows

2002-09-30 Thread dan
right, this is like an outline to what i want to be able to achieve.. -- my table --- row # : id , myid2 , myid3 --- row 1 : 1 , item 1 , item 2 row 2 : 2 , item 3 , item 4 row 3 : 3 , item 5 , item 6 row 4 : 4 , item 7 , item 8

Re: SQL Table Rows

2002-09-30 Thread Gary Stainburn
Hi Dan, I'm used to PostgreSQL, but using DBI, that shouldn't matter for what we're doing. On Monday 30 Sep 2002 1:54 pm, dan wrote: right, this is like an outline to what i want to be able to achieve.. -- my table --- row # : id , myid2 , myid3

RE: SQL Table Rows

2002-09-30 Thread Jeff AA
-Original Message- From: dan [mailto:[EMAIL PROTECTED]] Sent: 30 September 2002 13:55 To: [EMAIL PROTECTED] Subject: Re: SQL Table Rows snip __ START __ $id = 1; $sth = $dbh-prepare(SELECT * FROM table WHERE id=$id); $sth-execute; @ary = $sth-fetchrow_array; while ($ary[0

Re: SQL Table Rows

2002-09-30 Thread Cleiton L. Siqueira
Dan, In MySQL I don't know how you can do, but I believe that in theory is the same thing. #!/usr/bin/perl use Pg; $db= Pg::connectdb(dbname=database); open (FILE, /var/log/file.log); $result = $db-exec(SELECT * FROM table;); for($i=0;$i$result-ntuples;$i++) { $id =

Re: SQL Table Rows

2002-09-30 Thread david
Dan wrote: How is it possible to cycle through an SQL table row by row, without having to increment an ID by 1 in a while loop and go SELECT * FROM table WHERE id=$id ? And how can I find out how many rows are in the table? Dan have you try: SELECT * FROM table; and then just cycle it

Re: SQL Table Rows

2002-09-30 Thread Hengky
How is it possible to cycle through an SQL table row by row, without having to increment an ID by 1 in a while loop and go SELECT * FROM table WHERE id=$id ? And how can I find out how many rows are in the table? i hope this one can help you i'm using MySQL on my server $sth =