Jump to content

budimir

Members
  • Posts

    522
  • Joined

  • Last visited

Posts posted by budimir

  1. No, that's not it. In that part I'm getting only one user, because I wan't to know who is sending the email.

     

    All emails are here:

    $sql = "SELECT * FROM newsletter_primatelji WHERE list_id = '$list_id'";
       $result = mysql_query($sql,$veza) or die("ERROR IN QUERY:".$sql."<br>".mysql_error());
       while($row = mysql_fetch_array($result)){
          $primatelj[$row["email"]] = $row["ime"];   
       }

     

    When I print out that array I can see that all the emails are inside. But when the mail is being sent, it's sent only to the first mail in the list. I'm not quite sure why!

  2. Hey guys,

     

    Can you tell me where is the problem in this peace of code. I'm trying to send an email from a newsletter system I've built. But, the mail is not delivered. There is no error message. It isn't delivering emails.

     

    //Početak slanja newslettera
    
    $sql = "SELECT * FROM newsletter_primatelji WHERE list_id = '$list_id'";
    $result = mysql_query($sql,$veza) or die("ERROR IN QUERY:".$sql."<br>".mysql_error());
    while($row = mysql_fetch_array($result)){
    	$primatelj[$row["email"]] = $row["ime"];	
    }
    
    //print_r($primatelj);die;
    
    require("e-posta_inc-html.php");
    
    foreach ($primatelj as $key => $value){
    
    	include "newsletter_show.php";
    
    	$email_sadrzaj = $newsletter_show;
    	//echo "$email_sadrzaj";
    	//die;
    
    	$sqlUsM = "SELECT * FROM korisnici WHERE id='$user_id'";
    	$resultUsM = mysql_query($sqlUsM,$veza) or die (mysql_error());
    	$rowUsM = mysql_fetch_array($resultUsM);
    
    	$senderrr_email = $rowUsM["email"];
    	if ($senderrr_email == ""){
    		$senderrr_email = "husqvarna@drezga.hr";
    		}
    
    
    	//require_once("../phpmailer/class.phpmailer.php");
    
    
    	$mail = new PHPMailer();
    
    	$mail->IsSMTP();                      
    	$mail->Host = "server";  
    	$mail->SMTPAuth = false;     
    	$mail->Username = "";  
    	$mail->Password = ""; 
    
    	$mail->From = $senderrr_email;
    	$mail->FromName = "Drezga-Deržić d.o.o.";
    	$mail->AddAddress($key); //Ovdje nisam siguran kaj ide ($key, $value ili $primatelj)
    	$mail->AddReplyTo($senderrr_email, "Drezga-Deržić d.o.o.");
    
    	// Optional: Specify character coding and encoding
    	$mail->CharSet	= "utf-8";
    	$mail->Encoding	= "quoted-printable";		
    	$mail->IsHTML(true);
    	$mail->Subject = $naziv;
    	$mail->Body    = $email_sadrzaj;
    
    
    	$sql_att = "SELECT * FROM newsletter_privici WHERE newsletter_id = '$newsletter_id' AND file1 != '' ORDER by priv_id";
    	$result_att = mysql_query($sql_att,$veza) or die (mysql_error());
    	while($row_att = mysql_fetch_array($result_att)){
    		$mail->AddAttachment("privici/".$row_att["file1"],"");
    		$mail->AddAttachment("privici/".$row_att["file2"],"");
    		$mail->AddAttachment("privici/".$row_att["file3"],"");
    	}
    
    	if(!$mail->Send())
    	{
    		$not_sent_arr[$key] = $value;
    	}
    
    
    echo "<span style='font-family: Verdana; font-size: 11px;'>";
    
    if ($not_sent_arr != ""){
    	echo "<b>Neuspjelo slanje:</b><br>";
    	foreach ($not_sent_arr as $key => $value){
    		echo $key." - ".$value."<br>";
    	}
    }

  3. @ corbin:

     

    Data is coming from the php script I wrote. Do I need to put in formmating of that data???? Like to use UTF-8 or ISO or WIN????

     

    @ crtreedude:

     

    I tried typing in directly to SQL Server Managment Studio and everything is OK. But if I run my PHP script I get a lot of shit characters in the DB.

     

    I'm not sure why my PHP script is not putting the correct data to MSSQL DB!

  4. Hey guys,

     

    I have a question about inserting special characters into MSSQL from PHP.

     

    I'm from Croatia and our language has special characters like "ščćđž". I have setup collation for a MSSQL server as Croatian_CI_AI, but when I run my script the data in DB looks really strange. There is no special characters "čćšđž" in DB but some strange characters.

     

    Did anyone had a problem with this??? Is there any solutions???

  5. Guys,

     

    I have a problem.

     

    I have taken over a job to create a program in PHP which would connect on MSSQL and write and read data from it. The problem is that the guy which created the DB, didn't use standard marking for fileds and names.

     

    The name of the table on which I need to connect and put data in is "Drezga Deržič d_o_o_$OvlasteniServis" and PHP is not working with that. I'm getting an error message "Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near 'Derži�'. (severity 15) in C:\wamp\www\erp\sql_servis.php on line 88".

     

    Could I somehow trick PHP and replace "Drezga Deržič d_o_o_$OvlasteniServis" wth "Drezga_Derzic_d_o_o_$OvlasteniServis" or even simplier, but that I can still connect to that table???

     

    Does anyone have a solution how to go around this?

     

    Unfortunatelly I can't rename the table. It has to stay in that way.

     

  6. OK,

     

    I got that fixed. The problem was I had spaces in column names.

     

    Now the problem is the '-' sign in one of the variables. How do I force MSSQL to accept this data???

     

    This the error I'm getting:

     

    INSERT INTO OvlasteniServis (Vrstaservisa, Grad, Postanskibroj, Nazivservisa, Adresa, Telefon, Fax, E-mail) VALUES (1, 'Krk', 51500, 'CRO - FUTURA d.o.o.', 'Slavka Nikolića 48', '051/221-441', '', 'cro-futura@ri.htnet.hr')

     

    Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near '-'. (severity 15) in C:\wamp\www\erp\sql_servis.php on line 87

  7. Thanks a lot, rhodesa.

     

    I made a mistake and putted $ infront of the tbl_name. But, now I'm getting this error.

     

    INSERT INTO OvlasteniServis ([Vrsta servisa], [Grad], [Poštanski broj], [Naziv servisa], [Adresa], [Telefon], [Fax], [E-mail]) VALUES (1, 'Krk', 51500, 'CRO - FUTURA d.o.o.', 'Slavka Nikolića 48', '051/221-441', '', 'cro-futura@ri.htnet.hr')

    Warning: mssql_query() [function.mssql-query]: message: Invalid object name 'OvlasteniServis'. (severity 16) in C:\wamp\www\erp\sql_servis.php on line 87

  8. Hey guys,

     

    I'm using this query to insert data into MSSQL table

    $upit1 = "INSERT INTO $OvlasteniServis ([Vrsta servisa], [Grad], [Poštanski broj], [Naziv servisa], [Adresa], [Telefon], [Fax], [E-mail]) VALUES ('$da', '$grad', '$ptt', '$naziv', '$adresa', '$telefon', '$fax', '$email')";
    $rezultat1 = mssql_query($upit1,$veza3) or die ("MSSQL upit nije uspio!!!");

     

    And this is error message I'm getting:

     

    INSERT INTO (Vrsta servisa, Grad, Poštanski broj, Naziv servisa, Adresa, Telefon, Fax, E-mail) VALUES ('1', 'Krk', '51500', 'CRO - FUTURA d.o.o.', 'Slavka Nikolića 48', '051/221-441', '', 'cro-futura@ri.htnet.hr')

    Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near '('. (severity 15) in C:\wamp\www\erp\sql_servis.php on line 87

     

    I'm a new to MSSQL, so if you can help or point me to some page where I could read about this, I would appreciate it.

     

    Thanks a lot.

  9. I got it!!!

     

    This is the code I needed:

     

    <script type="text/javascript">
                function ChangeVal(Obj)
                {
                    var selected_option = Obj.selectedIndex;
                    var ctrl_id = Obj.id;
                    switch( ctrl_id )
                    {
                    case "prevozno_sredstvo":
                        document.getElementById("vrsta_prijevoza2").selectedIndex = selected_option;
    				document.getElementById("vrsta_prijevoza3").selectedIndex = selected_option;
    				document.getElementById("vrsta_prijevoza4").selectedIndex = selected_option;
    				document.getElementById("vrsta_prijevoza5").selectedIndex = selected_option;
    				document.getElementById("vrsta_prijevoza6").selectedIndex = selected_option;
    				document.getElementById("vrsta_prijevoza7").selectedIndex = selected_option;
                        break;
                    }
                }
    </script>

     

    It's working perfectly!!!!

     

    @toprashantjha

    Thanks a lot.

  10. @toprashantjha

     

    It's exactly what I need, but I have a problem. Here is the code I adjusted:

     

    <script type="text/javascript">
                function ChangeVal(Obj)
                {
                    var selected_option = Obj.selectedIndex;
                    var ctrl_id = Obj.id;
                    switch( ctrl_id )
                    {
                    case "prevozno_sredstvo":
                        document.getElementById("vrsta_prijevoza2").selectedIndex = selected_option;
                        break;
                    case "vrsta_prijevoza2":
                        document.getElementById("prevozno_sredstvo").selectedIndex = selected_option;
                        break;
                    case "vrsta_prijevoza3":
                        document.getElementById("prevozno_sredstvo").selectedIndex = selected_option;
                        break;
                    case "vrsta_prijevoza4":
                        document.getElementById("prevozno_sredstvo").selectedIndex = selected_option;
                        break;
                    case "vrsta_prijevoza5":
                        document.getElementById("prevozno_sredstvo").selectedIndex = selected_option;
                        break;
                    case "vrsta_prijevoza6":
                        document.getElementById("prevozno_sredstvo").selectedIndex = selected_option;
                        break;
                    case "vrsta_prijevoza7":
                        document.getElementById("prevozno_sredstvo").selectedIndex = selected_option;
                        break;
                    }
                }
    </script>

     

    My problem is, when I change first selecbox, only second select box changes it's value. How can I adjust it so all 6 is changed???

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.