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
    70
    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,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    select * from <table name> where `sent` = 0

    Thats the SQL you'd need.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #3
    New Coder
    Join Date
    Nov 2009
    Posts
    70
    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,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 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'); 

  • #5
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 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..
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!


  •  

    Posting Permissions

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