Re: temporary error
| From: | Mirco Soderi | Date: | Thu, 21 Feb 2008 15:08:24 +0000 |
| Subject: | Re: temporary error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-269787@lists.php.net to get a copy of this message | ||
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"" <m.soderi@alice.it> ha scritto nel messaggio
news:39.96.21621.F728DB74@pb1.pair.com...
> 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?