Autor Zpráva
leorond
Profil
Dobrý den,
chtěl bych odeslat hromadný email všem registrovaným ze svého webu při vložení např obrázku ale nedaří se mi vypsat z MSSQL databáze ze všech řádků potřebné emaily tak aby mezi nimi byla ( , ) a zároven jsem nemusel při každé nové registraci zapisovat jeho email někde do scryptu.
Dokázal by mi s tímto problémem někdo pomoci?

Jen bych chtěl dodat že jde o soukromé zprávy v rámci mého webu a žádný spam emailů :D
juriad
Profil
Nesnaž se získat jednotlivé e-maily oddělené čárkou. Získej je jako řádky a pak si je v PHP(?) spoj do jednoho řetězce. Databáze není určená k řetězcovým operacím, ale k rychlému přístupu k datům v jejich základním formátu.
leorond
Profil
Ano a co když je potřebuji vypsat z databáze tak abych je mohl hned do databáze odeslat?
Vlastně potřebuji aby se mi z jedné tabulky vypsal sloupec (id) a obratem všechny získané (id) zase insertem vložit do jiné tabulky.

Mám takovíto script a potřeboval bych s ním pomoci ale tak abych se to naučil a mohl si další úpravu udělat sám.

$result33        =    mssql_query("select count(id_msg) from EW_MAIL where reciver='$username_id' and type='inbox' and readed=0");
$myrow33        =    mssql_fetch_array($result33);
if    ($myrow33[0]    >    0)    $innbox    =    pm_inbox." ( $myrow33[0] )";    else    $innbox    =    pm_inbox;    
$t    =    $_GET['t'];
if    ($t    ==    'write')
{
    if    (isset($_POST['send_msg']))
    {
        $text        =    stripslashes($_POST['text']);
        $title        =    stripslashes($_POST['title']);
        $reciver    =    stripslashes($_POST['reciver']);
        $reciver    =    explode(",",$reciver);
        if    (empty($title)    ||    empty($text))
        {
            $error    =    "<ul><li>".eror_complete_data."</li></ul>";
        }
        elseif    (strlen($title)    >    100)
        {
            $error    =    "<ul><li>".profile_too_long_msg_title."</li></ul>";
        }
        elseif    (strlen($text)    >    1024)
        {
            $error    =    "<ul><li>".profile_too_long_msg."</li></ul>";
        }
        $ri    =    0;
        do
        {
            if    (!preg_match('/^['.$enemy["allow_char"].']/i',    $reciver[$ri])    or    empty($reciver[$ri]))
            {
                $error    =    "<ul><li>".eror_char_allow."</li></ul>";
            }
            else
            {
                $result11    =    mssql_query("select memb_name from memb_info where memb_name='$reciver[$ri]'");
                if    (mssql_num_rows($result11) <= 0) $error    =    "<ul><li>".nickname_not_found."</li></ul>";        
            }
            $ri++;
        }
        while    ($ri < count($reciver));
        if    (!$error) 
        {
            $title    =    UTF8RawUrlDecode(htmlentities($title));
            $title    =    replace_text('add',$title);
            $text    =    UTF8RawUrlDecode(htmlentities($text));
            $text    =    replace_text('add',$text);
            $ri        =    0;
            do
            {
                $result11    =    mssql_query("select memb_guid from memb_info where memb_name='$reciver[$ri]'");
                $myrow11    =    mssql_fetch_array($result11);
                mssql_query("insert into EW_MAIL (sender,reciver,msg_title,message,type,send_date,readed) values ('$username_id','$myrow11[memb_guid]','$title','$text','inbox','$real_time',0)");        
                mssql_query("insert into EW_MAIL (sender,reciver,msg_title,message,type,send_date,readed) values ('$username_id','$myrow11[memb_guid]','$title','$text','outbox','$real_time',1)");        
                $ri++;            
            }
            while    ($ri    <    count($reciver));
            echo    "<ul><li>".pm_success_sent."</li></ul>";
        }
        else
        {
            echo    $error;
        }
    }

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0