Re: [PHP] temporary error

2008-02-21 Thread Daniel Brown
On Thu, Feb 21, 2008 at 8:54 AM, Mirco Soderi <[EMAIL PROTECTED]> wrote:
> Consider the following code:
>
>  $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = "INSERT INTO ... etc etc
>  "
>  $queryInserimentoDatiAllenamentoCalciPiazzati =
>  mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati);
>  if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something }
[snip!]

Holy crap, so much for compact and clean code.  It must take you
days to write a script!  ;-P

In any case, there are a ton of syntax errors in your second block
of code.  Missing closing brackets, semicolons, et cetera.  It
shouldn't even compile (fatal errors).

Also, after rewriting all three blocks of code so that I could
read them without having a seizure, it looks like it's a problem with
your database.  Unless you're actually trying to see if
$sqlQueryInserimentoDatiAllenamentoCalciPiazzati is true (in block
#2), which you just defined as an SQL statement, whereas you're trying
to see if $queryInserimentoDatiAllenamentoCalciPiazzati is true (in
block #3), which you just defined as a resource identifier.

-- 


Daniel P. Brown
Senior Unix Geek


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] temporary error

2008-02-21 Thread Paul Scott

On Thu, 2008-02-21 at 14:54 +0100, Mirco Soderi wrote:
> Consider the following code:
> 
> $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = "INSERT INTO ... etc etc 

How long does it take you to write a single line of code with variable
names like that?

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] temporary error

2008-02-21 Thread Mirco Soderi
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