ono 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
>>
>>
of
> associative array) in a variable $row.
>
> Yuri Yarlei.
> Programmer PHP, CSS, Java, PostregreSQL;
> Today 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.0i
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
: 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, 16 Jun 2009 08:50:45 -0400, PJ wrote:
>
> > Ashley Sheridan 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
>>> well to linear alterations
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 =
>>
> autho
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
And, assuming the same table (just got the new email, sorry) for the update:
function makeUpdateQuery(array $authors, $bookId) {
foreach($authors as &$author) {
$author = mysql_real_escape_string($author);
}
if(!ctype_digit($bookId)) { return false; }
$existing = array();
$getAuthors = 'SEL
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 = mysql_real_esca
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 =
>>
> autho
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
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";
>
> $autho
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)
http://us.php.net/manual/en/language.variables.variable.ph
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 variab
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
>
[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
You could use list() a la
list($foo, $bar) = mysql_fetch_row();
On Mon, Jun 15, 2009 at 4:19 PM, PJ 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 would thi
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 d
[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
19 matches
Mail list logo