Jay Blanchard wrote:
> [snip]
> In what way would this simplify or ease my pain?
> The difficulty, it seems to me, is not in retrieving the rows, but
> rather how to pass the row data to the variables. And since the number
> of rows is variable, I believe that the only way to assign the variables
> is by use of a loop? I think I'm beating my head against the wall for
> nothing... :-(
> [/snip]
>
> You asked for easier. In this way the data is assigned to a usable
> variable right out of the gate and that is an array variable. You can
> actually use it with either mysql_fetch_array or mysql_fetch_row. 
>
> Here is your query;
>
> $sql = "SELECT first_name, last_name, book_author.ordinal
>       FROM author, book_author
>       WHERE book_author.bookID = $idIN && book_author.authID = author.id
> ORDER BY ordinal";
>
> You need not declare another array, but do it this way instead;
>
>    if ($results = mysql_query($sql, $db)) {
>         while ( $row = mysql_fetch_array($results, MYSQL_ASSOC) ) {
>             echo $row['first_name'];
>               echo $row['last_name'];
>   
Then I have to add some loopy thing to assign the values to the
$variables... a real pita since my variable do not lend themselves too
well to linear alterations ($varIn, $var2IN, $var3IN... etc... so $i=0
and $i++ arren't going to be too cooperative here... I guess I'd have to
change that to $var1IN... and then figure out how to do $var.$i.IN ... I
already tried, but don't seem to have it right
> ....etcetera.....
>         }
>     }
>
> The lazy part I will agree with :)
>   
Well, I shouldn't say it, but laziness is a characteristic of
"intelligence": why do more than you have to when you can be doing
something else. Actually, I am anything but lazy, I spend innumerable
hours trying to understand what all this coding is about... searching
the web and rummaging (and I do mean "rummaging") in all the lists and
posts ... but just going through 20 or 30 listings out of more than
20,000 is already taxing... much easier to ask on the list... if someone
can understand my fuzzy questions, they may find the grace and
generosity to take pity on the ignoramus... ;-)
And I enjoy the ribbing and the humour ... it's a really very nice list!


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-------------------------------------------------------------
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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

Reply via email to