A loop question?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Karzy

    #1

    A loop question?

    Having more problems with updating contacts. For all that responded to
    my previous problem THANKS. I accidentally deleted the posts so I
    couldn't do it with a reply.

    Anyhoo...

    When I send an email to an individual (for example) I include this in my
    mail script:

    $sql = "INSERT into player_contact values ('', '$player_id', '$_POST
    [cont_type]', '$_POST[cont_date]', '$_POST[cont_desc]')";
    $result = @mysql_query($s ql, $connection) or die(mysql_error ());
    //The primary and auto-increment key is the first value, then player_id
    of the individual, contact type, contact date, contact description

    However, if I send an email to my entire team (each having a player_id)
    I can't get it to insert a contact record for each. This is a problem
    with a team of over 100 football players as it takes forever to update
    each player individually.

    Thanks for any help. If anyone is interested I'm trying to put together
    a team/recruiting database. I always wonder what people are building
    when I read these posts, so I thought I'd throw that in.
  • Daniel

    #2
    Re: A loop question?

    Hi,

    I am not sure what you are doing, but I would not use $_post variables,
    but that is just my personal view on the subject.

    It seems that you are creating a record and sending a mail for 1 player
    per page view - the exection of this page sending somthing via mail()...

    I would transcode the variables into somthing more edible by MySQL, and
    maybe echo these variables to your page before displaying them, as to
    make sure that you are *really* inserting into your DB what you think
    you are inserting...

    I guess that your $_post[whatever] come from a previous web form... Have
    you tried:

    $qry = "INSERT INTO player_contact VALUES('', '$player_id',
    '$cont_type', '$cont_date', '$cont_desc')";

    mysql_query($qr y) or die("Could not execute the query");

    or from your example, run an print:
    print("INSERT into player_contact values ('', '$player_id',
    '$_POST[cont_type]', '$_POST[cont_date]', '$_POST[cont_desc]')");

    Cordially,

    Daniel


    Karzy wrote:[color=blue]
    > Having more problems with updating contacts. For all that responded to
    > my previous problem THANKS. I accidentally deleted the posts so I
    > couldn't do it with a reply.
    >
    > Anyhoo...
    >
    > When I send an email to an individual (for example) I include this in my
    > mail script:
    >
    > $sql = "INSERT into player_contact values ('', '$player_id', '$_POST
    > [cont_type]', '$_POST[cont_date]', '$_POST[cont_desc]')";
    > $result = @mysql_query($s ql, $connection) or die(mysql_error ());
    > //The primary and auto-increment key is the first value, then player_id
    > of the individual, contact type, contact date, contact description
    >
    > However, if I send an email to my entire team (each having a player_id)
    > I can't get it to insert a contact record for each. This is a problem
    > with a team of over 100 football players as it takes forever to update
    > each player individually.
    >
    > Thanks for any help. If anyone is interested I'm trying to put together
    > a team/recruiting database. I always wonder what people are building
    > when I read these posts, so I thought I'd throw that in.[/color]

    Comment

    Working...