array issues - PHP

This is a discussion on array issues - PHP ; Hi all, I am working on a project for someone and with the brief I received before - I created a record per action with the following information; Artist[tab]artist[tab]artist[tab] etc as a entry for "artists" Then I have the same ...

+ Reply to Thread
Results 1 to 3 of 3

array issues

  1. Default array issues

    Hi all,

    I am working on a project for someone and with the brief I received before -
    I created a record per action with the following information;

    Artist[tab]artist[tab]artist[tab] etc as a entry for "artists"

    Then I have the same for titles etc ...

    What I have been doing is creating the array's and combining them ... with
    artist as a key and song as a value...

    Now ... they are requesting that I have the an additional 3 fields ... how
    would I now accomplish this?

    Bear in mind its php 4 and I am using a combine_array generic from the
    www.php.net site in lieu of array_combine.

    I have paste a sample record below;

    INSERT INTO ` votes_records` (`id`, `date`, `who`, `title`, `description`,
    `image`, `email`, `artists`, `titles`, `votes`, `weeks`, `twoweekpos`,
    `oneweekpos`, `debut`) VALUES
    (22, '2007-02-26 12:29:15', 1, 'Test Again', '', '', '', 'Artist 1Artist
    2', 'Song 1Song 2', '1', '51', '20', '10',
    '2005/02/092005/02/09');

    The net effect that I need to get - is take that information and display it
    per item so people can vote.

    S

  2. Default Re: [PHP] array issues


    Just add another array for each with $artist as the key.


    while ($artist, $vote, $email) = mysql_fetch_row($results)){
    $votes[$artist] = $vote;
    $emails[$artist] = $email;
    }

    Although, actually, there is probably some better ways to do what you
    are doing, but with only the query to look at, it's hard to tell...

    On Mon, February 26, 2007 6:13 am, Steven Macintyre wrote:
    > Hi all,
    >
    > I am working on a project for someone and with the brief I received
    > before -
    > I created a record per action with the following information;
    >
    > Artist[tab]artist[tab]artist[tab] etc as a entry for "artists"
    >
    > Then I have the same for titles etc ...
    >
    > What I have been doing is creating the array's and combining them ...
    > with
    > artist as a key and song as a value...
    >
    > Now ... they are requesting that I have the an additional 3 fields ...
    > how
    > would I now accomplish this?
    >
    > Bear in mind its php 4 and I am using a combine_array generic from the
    > www.php.net site in lieu of array_combine.
    >
    > I have paste a sample record below;
    >
    > INSERT INTO ` votes_records` (`id`, `date`, `who`, `title`,
    > `description`,
    > `image`, `email`, `artists`, `titles`, `votes`, `weeks`, `twoweekpos`,
    > `oneweekpos`, `debut`) VALUES
    > (22, '2007-02-26 12:29:15', 1, 'Test Again', '', '', '', 'Artist
    > 1Artist
    > 2', 'Song 1Song 2', '1', '51', '20', '10',
    > '2005/02/092005/02/09');
    >
    > The net effect that I need to get - is take that information and
    > display it
    > per item so people can vote.
    >
    > S
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >



    --
    Some people have a "gift" link here.
    Know what I want?
    I want you to buy a CD from some starving artist.
    http://cdbaby.com/browse/from/lynch
    Yeah, I get a buck. So?

  3. Default Re: [PHP] array issues

    Richard Lynch wrote:
    > Just add another array for each with $artist as the key.
    >
    >
    > while ($artist, $vote, $email) = mysql_fetch_row($results)){

    I think you ment
    while ( list($artist, $vote, $email) = mysql_fetch_row($results) ){
    > $votes[$artist] = $vote;
    > $emails[$artist] = $email;
    > }
    >
    > Although, actually, there is probably some better ways to do what you
    > are doing, but with only the query to look at, it's hard to tell...
    >
    > On Mon, February 26, 2007 6:13 am, Steven Macintyre wrote:
    >> Hi all,
    >>
    >> I am working on a project for someone and with the brief I received
    >> before -
    >> I created a record per action with the following information;
    >>
    >> Artist[tab]artist[tab]artist[tab] etc as a entry for "artists"
    >>
    >> Then I have the same for titles etc ...
    >>
    >> What I have been doing is creating the array's and combining them ...
    >> with
    >> artist as a key and song as a value...
    >>
    >> Now ... they are requesting that I have the an additional 3 fields ...
    >> how
    >> would I now accomplish this?
    >>
    >> Bear in mind its php 4 and I am using a combine_array generic from the
    >> www.php.net site in lieu of array_combine.
    >>
    >> I have paste a sample record below;
    >>
    >> INSERT INTO ` votes_records` (`id`, `date`, `who`, `title`,
    >> `description`,
    >> `image`, `email`, `artists`, `titles`, `votes`, `weeks`, `twoweekpos`,
    >> `oneweekpos`, `debut`) VALUES
    >> (22, '2007-02-26 12:29:15', 1, 'Test Again', '', '', '', 'Artist
    >> 1Artist
    >> 2', 'Song 1Song 2', '1', '51', '20', '10',
    >> '2005/02/092005/02/09');
    >>
    >> The net effect that I need to get - is take that information and
    >> display it
    >> per item so people can vote.
    >>
    >> S
    >>
    >> --
    >> PHP General Mailing List (http://www.php.net/)
    >> To unsubscribe, visit: http://www.php.net/unsub.php
    >>
    >>

    >
    >



    --
    Enjoy,

    Jim Lucas

    Different eyes see different things. Different hearts beat on different
    strings. But there are times for you and me when all such things agree.

    - Rush

+ Reply to Thread