I'm having a problem when I want to send multi e-mails with PHP-Mailer inside a while.
I've the script that sends the email to 15 of 16 people when I'm doing to the SELECT in muy DB, and getting all the data with an array.
The code:
while($row=mysqli_fetch_array($rangocorreo)){
//Server settings
$mail->addAddress($row['correo'], $row['t_name']); // Add a recipient
$mail->Subject = 'Test';
$mail->Body = 'Esto es una mensaje de Prueba';
$mail->AltBody = '¡Test!';
$mail->ConfirmReadingTo = '';
//$mail->send();
if(!$mail->send()) {
//echo 'El mensaje no pudo enviarse. Motivo: ' . $mail->ErrorInfo;
}
$mail->ClearAddresses();
//usleep(500000);
}
I tried with different forms of the code, but finally only sends 15 instead of 16. (The e-mail is missing) Just a note, if I do the SELECT in the DB, gives me the 16 emails that I want, so I think the problem is not in the DB or in the query, I think is in this code.
Can you help me?
Kinds Regards.
If I run:
exec('myString') at [myserver]
my selection works correctly
If I do:
declare #mystring nvarchar(max) = 'myString'
exec(#mystring) at [myserver]
(Righe interessate: 2)
OLE DB provider "IBMDASQL" for linked server "myserver" returned message "SQL0104: Token '' non valido. Token validi: ( CL END GET SET CALL DROP FREE HOLD LOCK OPEN WITH ALTER BEGIN.
Causa . . . : È stato rilevato un errore di sintassi sul token ''. Il token '' non è valido. Un elenco parziale dei token validi è ( CL END GET SET CALL DROP FREE HOLD LOCK OPEN WITH ALTER BEGIN. Questo elenco presuppone che l'istruzione sia corretta fino al token. È possibile che l'errore sia precedente nell'istruzione, ,ma la sintassi dell'istruzione sembrava valida fino a questo punto. Correzione . . : Effettuare almeno una delle seguenti operazioni e ripetere: -- Verificare l'istruzione SQL nell'area del token ''. Correggere l'istruzione. L'errore potrebbe essere una virgola o apici mancanti, una parola scritta in modo scorretto oppure potrebbe essere relativo all'ordine delle clausole. -- Se il token di errore è , correggere l'istruzione SQL perché non termina con una clausola valida.".
(Righe interessate: 0)
Messaggio 7215, livello 17, stato 1, riga 308
Could not execute statement on remote server 'myserver'.
Here is the english version of SQL0104
Message ID . . . . . . . . . : SQL0104
Message file . . . . . . . . : QSQLMSG
Library . . . . . . . . . : QSYS
Message . . . . : Token &1 was not valid. Valid tokens: ( CL END GET SET CALL DROP FREE HOLD LOCK OPEN WITH ALTER BEGIN.
Cause . . . . . : A syntax error was detected at token ''. Token '' is not
a valid token. A partial list of valid tokens is ( CL END GET SET CALL DROP FREE HOLD LOCK OPEN WITH ALTER BEGIN. This list assumes that the statement is correct up to the token. The error may be earlier in
the statement, but the syntax of the statement appears to be valid up to
this point.
Recovery . . . : Do one or more of the following and try the request again:
-- Verify the SQL statement in the area of the token ''. Correct the
statement. The error could be a missing comma or quotation mark, it could
be a misspelled word, or it could be related to the order of clauses.
-- If the error token is , correct the SQL statement
because it does not end with a valid clause.
I have this error each time I check "remember me" on authentication.
What could be the problem ?
Thank you
Dom
2016.04.12 18:49:27 ERROR web[o.s.s.ui.JRubyFacade] Fail to render: http://cerbere:9001/sessions/login
ActiveRecord::JDBCError: La conversion d'un type de donn?es varchar en type de donn?es datetime a cr?? une valeur hors limites.: UPDATE [users] SET [remember_token_expires_at] = '2016-04-26 16:49:26', [remember_token] = N'4fa37dcb929dce851bb153cebc204bc300518d14', [updated_at] = 1460479767007 WHERE [id] = N'2'
/opt/sonar/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
/opt/sonar/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:212:in `log'
/opt/sonar/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183:in `execute'
/opt/sonar/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:199:in `jdbc_update'
/opt/sonar/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/query_cache.rb:26:in `update_with_query_dirty'
/opt/sonar/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/base.rb:2946:in `update'
/opt/sonar/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/locking/optimistic.rb:81:in `update_with_lock'
/opt/sonar/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/dirty.rb:146:in `update_with_dirty'
/opt/sonar/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/timestamp.rb:64:in `update_with_timestamps'
/opt/sonar/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/callbacks.rb:282:in `update_with_callbacks'
The problem was on soanrqube 5.4. It was due to my sqlserver user language that was not english.
I read again sonarqube installation documentation, and it's not very clear what to do for MS SQLServer.
I'm working on a script to automatically configure Nodemanager, enroll a machine and starting de managed servers in it. What i currently have is (not exactly):
connect(...)
cd('/')
for m in cmo.getMachines():
nombre_machine=m.getName()
#Solo ejecutamos el NodeManager en el que estamos ejecutando el script.
if nombre_machine in HOST:
cd('/Machines/'+nombre_machine+'/NodeManager/'+nombre_machine)
machine=cmo
nm_srv_addrs[machine.getListenPort()] = machine.getListenAddress()
for nm_port, nm_addr in nm_srv_addrs.iteritems():
printInStyle('Iniciando Nodemanager, favor tener paciencia la primera vez.')
startNodeManager(verbose='false', NodeManagerHome=NM_HOME, ListenPort=str(nm_port), ListenAddress=nm_addr)
print 'Generando nodemanager.properties ',
while not os.path.exists(NM_PROP_FILE):
systime.sleep(10)
print '\b.',
sys.stdout.flush()
print 'Archivo creado!'
cd('/')
servidores = cmo.getServers()
for s in servidores:
nombre = s.getName()
if nombre != 'AdminServer':
start(nombre)
But the last sequence will fail because will try to start all servers and i'm looking to start only the in the one i'm running the script.
What i believe i'm looking is a way to filter the servers in the current machine.
I'll appreciate any help or advice. I am just starting in wlst scripting.
thanks
I figured it out thanks to this link
I'll just need to filter in a couple of loops like this:
import os
cd('/')
current_m=''
machines = cmo.getMachines()
for m in machines:
hostname = os.environ['HOSTNAME']
nm = m.getNodeManager()
if nm.getListenAddress() in hostname:
current_m=m
servers = cmo.getServers()
for s in servers:
name = s.getName()
if name != 'AdminServer':
ref = getMBean('/Servers/'+name+'/Machine/'+current_m.getName())
if ref != None:
start(name)
I have a an Access form with a subform in datasheet mode with edit mode allowed. All tables are stored inside an SQL Server (2008R2) and I just added a new column (bit not null default 0)
The subform datasource span on 3 tables and is working just fine as it is. However, as soon as I add a new column, everytime I try to change data, I get this error :
If I remove the column I just added, everything seems to work again.
Here is the datasource before
SELECT tblCommandeListe.Section, tblCommandeListe.Description, tblCommandeListe.[No item], tblCommandeListe.N°Commande, tblCommandeListe.Code, tblCommandeListe.Qte, tblCommandeListe.Dim, tblFournisseur.[Fournisseur-Nom], tblCommandeListe.Prix, tblCommandeListe.[Date de livraison], tblCommandeListe.[Cost Center], tblCommandeListe.Devise, tblCommandeListe.Complet, tblCommandeListe.[LB/Lin], tblCommandeListe.[Prix/lb], tblCommandeListe.Unite, tblCommandeListe.[Note 2], tblCo mmandeListe.Ordre, tblProduits.[Produit-DescriptionFRA], tblProduits.[Produit-Prix], tblProduits.[Produit-Unite], tblProduits.[Produit-Fournisseur], tblProduits.[Produit-LB/Lin], tblProduits.[Produit-Prix/lb], tblProduits.[Produit-Long nom], tblProduits.[Produit-Devise], tblCommandeListe.Condition, tblCommandeListe.[Date création], tblCommandeListe.[Enlever liste à commander], tblCommandeListe.[Unite ing], tblProduits.[Produit-Unite_ing], tblCommandeListe.[Dim ing], tblCommandeListe.DescTmp, tblCommandeListe.[User mod], tblCommandeListe.[Qte req], tblCommandeListe.Annuler, IIf(IsNull([Qte req]),0,[Qte req])*IIf(IsNull([Prix]),0,[Prix])*IIf(IsNull([Dim]),1,[Dim])*IIf(IsNull([LB/Lin]) Or [LB/Lin]=0,1,[LB/Lin]) AS Total, tblCommandeListe.[Relaché pour achat], tblProduits.[Produit-Priorité], tblFournisseur.[Fournisseur-Nom]
FROM (tblCommandeListe
LEFT JOIN tblProduits ON tblCommandeListe.Code = tblProduits.[Produit- Code])
LEFT JOIN tblFournisseur ON tblProduits.[Produit-Fournisseur] = tblFournisseur.Fournisseur_id
ORDER BY tblCommandeListe.Section, tblCommandeListe.Description;
and after I add the column
SELECT tblCommandeListe.Section, tblCommandeListe.Description, tblCommandeListe.[No item], tblCommandeListe.N°Commande, tblCommandeListe.Code, tblCommandeListe.Qte, tblCommandeListe.Dim, tblFournisseur.[Fournisseur-Nom], tblCommandeListe.Prix, tblCommandeListe.[Date de livraison], tblCommandeListe.[Cost Center], tblCommandeListe.Devise, tblCommandeListe.Complet, tblCommandeListe.[LB/Lin], tblCommandeListe.[Prix/lb], tblCommandeListe.Unite, tblCommandeListe.[Note 2], tblCommandeListe.Ordre, tblProduits.[Produit-DescriptionFRA], tblProduits.[Produit-Prix], tblProduits.[Produit-Unite], tblProduits.[Produit-Fournisseur], tblProduits.[Produit-LB/Lin], tblProduits.[Produit-Prix/lb], tblProduits.[Produit-Long nom], tblProduits.[Produit-Devise], tblCommandeListe.Condition, tblCommandeListe.[Date création], tblCommandeListe.[Enlever liste à commander], tblCommandeListe.[Unite ing], tblProduits.[Produit-Unite_ing], tblCommandeListe.[Dim ing], tblCommandeListe.DescTmp, tblCommandeListe.[User mod], tblCommandeListe.[Qte req], tblCommandeListe.Annuler, IIf(IsNull([Qte req]),0,[Qte req])*IIf(IsNull([Prix]),0,[Prix])*IIf(IsNull([Dim]),1,[Dim])*IIf(IsNull([LB/Lin]) Or [LB/Lin]=0,1,[LB/Lin]) AS Total, tblCommandeListe.[Relaché pour achat], tblProduits.[Produit-Priorité], tblFournisseur.[Fournisseur-Nom], tblCommandeListe.EstProduction
FROM (tblCommandeListe
LEFT JOIN tblProduits ON tblCommandeListe.Code = tblProduits.[Produit- Code])
LEFT JOIN tblFournisseur ON tblProduits.[Produit-Fournisseur] = tblFournisseur.Fournisseur_id
ORDER BY tblCommandeListe.Section, tblCommandeListe.Description;
The only difference I see is the new column at the end. I tried with other columns and so far, it still works after, so the problem might be the column itself, but how can that be ?
EDIT : I just did a test and it seems I get the exact same message when I tried to edit it directly in the table in Access!