SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi all.

    I am having problems here :

    http://216.74.114.212/addr.phps

    It seems to explode the 1st textarea fine, and insert the contents into the DB, but it stops there.

    What am I doing wrong ?

    Thanks,
    James

  2. #2
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    any1 ? this is well urgent.

    thanks
    j

  3. #3
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry to bug you all, but can anyone help ?

    J

  4. #4
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know if this is your problem, but I would code the textarea boxes like so:
    Code:
    <textarea*name="no_of_tracks"*ROWS=10*COLS=40*wrap="hard">

  5. #5
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    Alkmaar, Netherlands
    Posts
    710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    without telling us more how can we help you?
    post your code that you are inserting data into database.

  6. #6
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code is contained in the phps file - the source will automatically be shown to you if you click on it.

    James

  7. #7
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sylow, James has provided a link to the code in his first post.

  8. #8
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    James, I'm thinking about your problem and the only other thing I can think of is to use a different variable name for each array; ie, don't recycle $track_array for each textarea string.

    I'm just guessing here. The reason I'm thinking this is that in most other languages I know you can't just have an array variable and then go and reassign another array to it - arrays are usually tricky like this because in most languages an array contains a fixed number of elements.

    I don't quite understand how arrays work in PHP. PHP arrays seem to behave like arrays, lists, and hash tables (dictionaries). So this may not be the problem, but I'm just thinking ...

    Actually, thinking about it more. It might be that you just need to reset the array pointer after you've finished the for loop:

    reset($track_array);

    hmmm...
    Last edited by freakysid; Mar 28, 2001 at 08:59.

  9. #9
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    Washington State
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All these are being submitted under the same ID, is this what you want? How is your ID setup, is it auto-increment and primary key? Why are you using mysql_insert_id() ?

    freakysid, PHP has very friendly arrays, no need to worry about such things, thankfully.

    Also consider using an array in your textarea, it'll allow the form processer to be simpler/shorter/easier to manage.

    <textarea name="somename[]" rows="10" cols="50"></textarea>

  10. #10
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They should all be submitted using the same ID.

    I am using mysql_insert_id to obtain the ID of the previously inserted release, and then assign each track (each of which have their own row), and then assign the track to the release.

    If I don't have to re-set it, what's wrong ?

    Thanks again,
    James


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •