Re: [PHP] how to extract fields from associative array into different variables

2009-06-18 Thread Nisse Engström
On Tue, 16 Jun 2009 08:50:45 -0400, PJ wrote: Ashley Sheridan wrote: On Mon, 2009-06-15 at 17:38 -0400, PJ wrote: 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,

Re: [PHP] how to extract fields from associative array into different variables

2009-06-18 Thread PJ
Nisse Engström wrote: On Tue, 16 Jun 2009 08:50:45 -0400, PJ wrote: Ashley Sheridan wrote: On Mon, 2009-06-15 at 17:38 -0400, PJ wrote: 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

Re: [PHP] how to extract fields from associative array into different variables

2009-06-18 Thread Eddie Drapkin
PHP, tomorrow Java, after the world. Kyou wa PHP, ashita wa Java, sono ato sekai desu. To: php-general@lists.php.net From: news.nospam.0ixbt...@luden.se Date: Thu, 18 Jun 2009 14:17:59 +0200 Subject: Re: [PHP] how to extract fields from associative array into   different variables On Tue

Re: [PHP] how to extract fields from associative array into different variables

2009-06-16 Thread Ashley Sheridan
On Mon, 2009-06-15 at 17:38 -0400, PJ wrote: 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

Re: [PHP] how to extract fields from associative array into different variables

2009-06-16 Thread kranthi
you dont have an alternative. you will have to loop because mysql_fetch_* functions fetch only one row at a time. you can use variable variables to achieve the above result (you will not require this if u use list() or extract() functions)

RE: [PHP] how to extract fields from associative array into different variables

2009-06-16 Thread Ford, Mike
On 15 June 2009 18:07, PJ advised: Is there an easier or simpler way to do this? code: $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; $author = array();

Re: [PHP] how to extract fields from associative array into different variables

2009-06-16 Thread PJ
Ashley Sheridan wrote: On Mon, 2009-06-15 at 17:38 -0400, PJ wrote: 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

Re: [PHP] how to extract fields from associative array into different variables

2009-06-16 Thread PJ
Ford, Mike wrote: On 15 June 2009 18:07, PJ advised: Is there an easier or simpler way to do this? code: $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

Re: [PHP] how to extract fields from associative array into different variables

2009-06-16 Thread Eddie Drapkin
I'm going to assume that your table is setup to have the rows BookID and AuthorName, adjust accordinging: function makeInsertQuery(array $authors, $bookId) { $sql = INSERT INTO book_authors (BookID, AuthorName) VALUES ('$bookId', '; foreach($authors as $author) { $author =

RE: [PHP] how to extract fields from associative array into different variables

2009-06-16 Thread Ford, Mike
On 16 June 2009 13:58, PJ advised: Ford, Mike wrote: On 15 June 2009 18:07, PJ advised: Is there an easier or simpler way to do this? code: $sql = SELECT first_name, last_name, book_author.ordinal FROM author, book_author WHERE book_author.bookID = $idIN

Re: [PHP] how to extract fields from associative array into different variables

2009-06-16 Thread PJ
Ford, Mike wrote: On 15 June 2009 18:07, PJ advised: Is there an easier or simpler way to do this? code: $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

RE: [PHP] how to extract fields from associative array into different variables

2009-06-15 Thread Jay Blanchard
[snip] Is there an easier or simpler way to do this? [/snip] http://us2.php.net/manual/en/function.mysql-fetch-row.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] how to extract fields from associative array into different variables

2009-06-15 Thread PJ
Jay Blanchard wrote: [snip] Is there an easier or simpler way to do this? [/snip] http://us2.php.net/manual/en/function.mysql-fetch-row.php 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

Re: [PHP] how to extract fields from associative array into different variables

2009-06-15 Thread Eddie Drapkin
You could use list() a la list($foo, $bar) = mysql_fetch_row(); On Mon, Jun 15, 2009 at 4:19 PM, PJ af.gour...@videotron.ca wrote: Jay Blanchard wrote: [snip] Is there an easier or simpler way to do this? [/snip] http://us2.php.net/manual/en/function.mysql-fetch-row.php In what way

RE: [PHP] how to extract fields from associative array into different variables

2009-06-15 Thread Jay Blanchard
[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

Re: [PHP] how to extract fields from associative array into different variables

2009-06-15 Thread PJ
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