Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Nov 2009
    Posts
    71
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Scan through a table

    Hi

    I have a email table (to, email, subject , ect.) and already have the php code to send may from a record of the table.


    Now I need a way to scan the table and execute mycode to build email from each row of the table.

    Something as

    Scan table email where sent = 0

    Is there any hint about this issue ?

    Moises

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,366
    Thanks
    61
    Thanked 530 Times in 517 Posts
    select * from <table name> where `sent` = 0

    Thats the SQL you'd need.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #3
    New Coder
    Join Date
    Nov 2009
    Posts
    71
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tangoforce View Post
    select * from <table name> where `sent` = 0

    Thats the SQL you'd need.
    I don't think so. I have to go through the table looking for sent = 0 condition and executing a code at every row where sent = 0 and replacing sent with 1.

    As far as a know, select will just return list of data.

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    That's the point of the SQL. The WHERE condition is searching for the condition of 0 or false being set to the property sent. You can then iterate the records or add them to carbon copies or whatever.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #5
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,366
    Thanks
    61
    Thanked 530 Times in 517 Posts
    Quote Originally Posted by moisesbr View Post
    I don't think so. I have to go through the table looking for sent = 0 condition and executing a code at every row where sent = 0 and replacing sent with 1.

    As far as a know, select will just return list of data.
    Ok you clearly know best so why not go away and work it out yourself then? - Clearly my advice is inferior

    If you don't want to run any php on the records you could just run SQL that will change it all:

    update <table name> set `sent` = 1 where `sent` = 0

    I promise I won't try to assist again..
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!


  •  

    Posting Permissions

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