[PHP] temporary error
Consider the following code: $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = "INSERT INTO ... etc etc " $queryInserimentoDatiAllenamentoCalciPiazzati = mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati); if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something } if($queryInserimentoDatiAllenamentoCalciPiazzati) { $logQueryInserimentoDatiAllenamentoCalciPiazzati = mysql_query("insert into log ... etc etc ..."); if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something } } if($queryInserimentoDatiAllenamentoCalciPiazzati && $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something } 1st execution: $queryInserimentoDatiAllenamentoCalciPiazzati && $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of last conditional statement, evaluates to false even if both queries are correctly executed. I modify as follows: $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = "INSERT INTO ... etc etc " $queryInserimentoDatiAllenamentoCalciPiazzati = mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati); if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something } else echo("error message 1"); if($queryInserimentoDatiAllenamentoCalciPiazzati) { $logQueryInserimentoDatiAllenamentoCalciPiazzati = mysql_query("insert into log ... etc etc ..."); if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something } else echo("error message 2"); } if($queryInserimentoDatiAllenamentoCalciPiazzati && $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something } 2nd execution: $queryInserimentoDatiAllenamentoCalciPiazzati && $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of last conditional statement, evaluates to true. Now, I modify again, back to the original version: $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = "INSERT INTO ... etc etc " $queryInserimentoDatiAllenamentoCalciPiazzati = mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati); if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something } if($queryInserimentoDatiAllenamentoCalciPiazzati) { $logQueryInserimentoDatiAllenamentoCalciPiazzati = mysql_query("insert into log ... etc etc ..."); if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something } } if($queryInserimentoDatiAllenamentoCalciPiazzati && $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something } 3rd execution: $queryInserimentoDatiAllenamentoCalciPiazzati && $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of last conditional statement, evaluates to true. Do you know any reason for that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: temporary error
In my opinion, variable names are a personal choice, I think the time you loose when writing the name (about a second is long less than the time you gain when, months later, you go and modify the code and you have clear the content and meaning of each variable. In the original code there were no sintax errors, I added some errors when pasting here. Sorry. I have found that in the first execution, it was the $logQueryInserimentoDatiAllenamentoCalciPiazzati that evaluated to false. After having removed the two-field key that I had originally defined for that table and having added an autoincrement key, the problem seems to be solved. Do you find any reason for that? ""Mirco Soderi"" <[EMAIL PROTECTED]> ha scritto nel messaggio news:[EMAIL PROTECTED] > Consider the following code: > > $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = "INSERT INTO ... etc > etc " > $queryInserimentoDatiAllenamentoCalciPiazzati = > mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati); > if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something } > if($queryInserimentoDatiAllenamentoCalciPiazzati) { >$logQueryInserimentoDatiAllenamentoCalciPiazzati = mysql_query("insert > into log ... etc etc ..."); >if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do > something } > } > if($queryInserimentoDatiAllenamentoCalciPiazzati && > $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something } > > 1st execution: $queryInserimentoDatiAllenamentoCalciPiazzati && > $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of last > conditional statement, evaluates to false even if both queries are > correctly executed. > > I modify as follows: > > $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = "INSERT INTO ... etc > etc " > $queryInserimentoDatiAllenamentoCalciPiazzati = > mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati); > if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something } else > echo("error message 1"); > if($queryInserimentoDatiAllenamentoCalciPiazzati) { >$logQueryInserimentoDatiAllenamentoCalciPiazzati = mysql_query("insert > into log ... etc etc ..."); >if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do > something } else echo("error message 2"); > } > if($queryInserimentoDatiAllenamentoCalciPiazzati && > $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something } > > 2nd execution: $queryInserimentoDatiAllenamentoCalciPiazzati && > $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of last > conditional statement, evaluates to true. > > Now, I modify again, back to the original version: > > $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = "INSERT INTO ... etc > etc " > $queryInserimentoDatiAllenamentoCalciPiazzati = > mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati); > if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something } > if($queryInserimentoDatiAllenamentoCalciPiazzati) { >$logQueryInserimentoDatiAllenamentoCalciPiazzati = mysql_query("insert > into log ... etc etc ..."); >if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do > something } > } > if($queryInserimentoDatiAllenamentoCalciPiazzati && > $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something } > > 3rd execution: $queryInserimentoDatiAllenamentoCalciPiazzati && > $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of last > conditional statement, evaluates to true. > > Do you know any reason for that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: temporary error
[snip] Is that irony? [/snip] no -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SimpleXML strange behaviour.
Do you know any reason why the following code does work $xmlOperazioni = simplexml_load_file($xmlFilename); foreach($xmlOperazioni->operazione as $operazione) { if($operazione['nome'] == $operazioneRichiesta) { require($operazione['php']); break; } } but the following does not $xmlOperazioni = simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_operazioni']); foreach($xmlOperazioni->operazione as $operazione) { if($operazione->nome == $operazioneRichiesta) { require($operazione->php); break; } } that is I MUST access childrens of the element as if it was an array, while (in the same page) the following code does work $xmlViste = simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_composizione_viste']); foreach($xmlViste->vista as $vista) { if($vista->nome == $nomeVistaDaMostrare) { $smarty->assign("intestazione","componenti/".$vista->intestazione); $smarty->assign("menu","componenti/".$vista->menu); $smarty->assign("contenuto", "componenti/".$vista->contenuto); $smarty->assign("pie_di_pagina", "componenti/".$vista->pie_di_pagina); break; } } but the following does not $xmlViste = simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_composizione_viste']); foreach($xmlViste->vista as $vista) { if($vista['nome'] == $nomeVistaDaMostrare) { $smarty->assign("intestazione","componenti/".$vista['intestazione']); $smarty->assign("menu","componenti/".$vista['menu']); $smarty->assign("contenuto", "componenti/".$vista['contenuto']); $smarty->assign("pie_di_pagina", "componenti/".$vista['pie_di_pagina']); break; } } that is this time I MUST access the childrens of the element as if it was an object?