Discussion:
Operand error...
Karl-Arne Gjersøyen
2013-08-08 17:32:42 UTC
Permalink
$oppdater_lager_med_antall_kg = $kg_pa_lager +
$kg_fra_transportdokument_inn_pa_valgt_lager;


result:
*Fatal error*: Unsupported operand types in *
/Users/karl/Sites/kasen/io/kp/index.php* on line *2970

*I have also tried this:
$kg_pa_lager += $kg_fra_transportdokument_inn_pa_valgt_lager;

Both of them return this Fatal error.
I am using Dreamweaver CS6 and the syntax check in my software say: "No
syntax error"

What am I doing wrong this time?

Thanks for your good advice!

Karl
Jim Giner
2013-08-08 17:34:19 UTC
Permalink
Post by Karl-Arne Gjersøyen
$oppdater_lager_med_antall_kg = $kg_pa_lager +
$kg_fra_transportdokument_inn_pa_valgt_lager;
*Fatal error*: Unsupported operand types in *
/Users/karl/Sites/kasen/io/kp/index.php* on line *2970
$kg_pa_lager += $kg_fra_transportdokument_inn_pa_valgt_lager;
Both of them return this Fatal error.
I am using Dreamweaver CS6 and the syntax check in my software say: "No
syntax error"
What am I doing wrong this time?
Thanks for your good advice!
Karl
You do a var_dump on each variable to see what type they were defined as.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Karl-Arne Gjersøyen
2013-08-08 17:43:34 UTC
Permalink
Post by Karl-Arne Gjersøyen
$oppdater_lager_med_antall_kg = $kg_pa_lager +
$kg_fra_transportdokument_inn_**pa_valgt_lager;
*Fatal error*: Unsupported operand types in *
/Users/karl/Sites/kasen/io/kp/**index.php* on line *2970
$kg_pa_lager += $kg_fra_transportdokument_inn_**pa_valgt_lager;
Both of them return this Fatal error.
I am using Dreamweaver CS6 and the syntax check in my software say: "No
syntax error"
What am I doing wrong this time?
Thanks for your good advice!
Karl
You do a var_dump on each variable to see what type they were defined as.
NULL array(2) { [0]=> string(3) "100" [1]=> string(3) "340" }
Jim Giner
2013-08-08 17:51:29 UTC
Permalink
Post by Karl-Arne Gjersøyen
Post by Karl-Arne Gjersøyen
$oppdater_lager_med_antall_kg = $kg_pa_lager +
$kg_fra_transportdokument_inn_**pa_valgt_lager;
*Fatal error*: Unsupported operand types in *
/Users/karl/Sites/kasen/io/kp/**index.php* on line *2970
$kg_pa_lager += $kg_fra_transportdokument_inn_**pa_valgt_lager;
Both of them return this Fatal error.
I am using Dreamweaver CS6 and the syntax check in my software say: "No
syntax error"
What am I doing wrong this time?
Thanks for your good advice!
Karl
You do a var_dump on each variable to see what type they were defined as.
NULL array(2) { [0]=> string(3) "100" [1]=> string(3) "340" }
That is one var. What is the other var?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Karl-Arne Gjersøyen
2013-08-08 17:56:38 UTC
Permalink
Post by Karl-Arne Gjersøyen
Post by Karl-Arne Gjersøyen
$oppdater_lager_med_antall_kg = $kg_pa_lager +
$kg_fra_transportdokument_inn_****pa_valgt_lager;
*Fatal error*: Unsupported operand types in *
/Users/karl/Sites/kasen/io/kp/****index.php* on line *2970
$kg_pa_lager += $kg_fra_transportdokument_inn_****pa_valgt_lager;
Both of them return this Fatal error.
I am using Dreamweaver CS6 and the syntax check in my software say: "No
syntax error"
What am I doing wrong this time?
Thanks for your good advice!
Karl
You do a var_dump on each variable to see what type they were defined as.
NULL array(2) { [0]=> string(3) "100" [1]=> string(3) "340" }
That is one var. What is the other var?
Thank you very much!
Now I know the error.. One of those variables are NULL! When I fix it I
think it work!

Karl
Jim Giner
2013-08-08 18:05:36 UTC
Permalink
Post by Karl-Arne Gjersøyen
Post by Karl-Arne Gjersøyen
Post by Karl-Arne Gjersøyen
$oppdater_lager_med_antall_kg = $kg_pa_lager +
$kg_fra_transportdokument_inn_****pa_valgt_lager;
*Fatal error*: Unsupported operand types in *
/Users/karl/Sites/kasen/io/kp/****index.php* on line *2970
$kg_pa_lager += $kg_fra_transportdokument_inn_****pa_valgt_lager;
Both of them return this Fatal error.
I am using Dreamweaver CS6 and the syntax check in my software say: "No
syntax error"
What am I doing wrong this time?
Thanks for your good advice!
Karl
You do a var_dump on each variable to see what type they were defined as.
NULL array(2) { [0]=> string(3) "100" [1]=> string(3) "340" }
That is one var. What is the other var?
Thank you very much!
Now I know the error.. One of those variables are NULL! When I fix it I
think it work!
Karl
actually, the null is ok I think. The array is wrong - you can't 'add'
an array to a scalar variable, which an integer or null is.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Karl-Arne Gjersøyen
2013-08-08 18:11:02 UTC
Permalink
Post by Jim Giner
Post by Karl-Arne Gjersøyen
Post by Karl-Arne Gjersøyen
Post by Karl-Arne Gjersøyen
$oppdater_lager_med_antall_kg = $kg_pa_lager +
$kg_fra_transportdokument_inn_******pa_valgt_lager;
*Fatal error*: Unsupported operand types in *
/Users/karl/Sites/kasen/io/kp/******index.php* on line *2970
$kg_pa_lager += $kg_fra_transportdokument_inn_******pa_valgt_lager;
Both of them return this Fatal error.
I am using Dreamweaver CS6 and the syntax check in my software say: "No
syntax error"
What am I doing wrong this time?
Thanks for your good advice!
Karl
You do a var_dump on each variable to see what type they were
defined
as.
NULL array(2) { [0]=> string(3) "100" [1]=> string(3) "340" }
That is one var. What is the other var?
Thank you very much!
Now I know the error.. One of those variables are NULL! When I fix it I
think it work!
Karl
actually, the null is ok I think. The array is wrong - you can't 'add'
an array to a scalar variable, which an integer or null is.
Yes, it is me and arrays again :D

$resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
$antall = mysql_num_rows($resultat);
for($i = 0; $i < $antall; $i++){
$rad = mysql_fetch_array($resultat, MYSQL_ASSOC);

and write it tis way can perhaps make someting more correct?
For example $variable[$i] ?

Karl
Jim Giner
2013-08-08 20:37:33 UTC
Permalink
Post by Karl-Arne Gjersøyen
Post by Jim Giner
Post by Karl-Arne Gjersøyen
Post by Karl-Arne Gjersøyen
Post by Karl-Arne Gjersøyen
$oppdater_lager_med_antall_kg = $kg_pa_lager +
$kg_fra_transportdokument_inn_******pa_valgt_lager;
*Fatal error*: Unsupported operand types in *
/Users/karl/Sites/kasen/io/kp/******index.php* on line *2970
$kg_pa_lager += $kg_fra_transportdokument_inn_******pa_valgt_lager;
Both of them return this Fatal error.
I am using Dreamweaver CS6 and the syntax check in my software say: "No
syntax error"
What am I doing wrong this time?
Thanks for your good advice!
Karl
You do a var_dump on each variable to see what type they were
defined
as.
NULL array(2) { [0]=> string(3) "100" [1]=> string(3) "340" }
That is one var. What is the other var?
Thank you very much!
Now I know the error.. One of those variables are NULL! When I fix it I
think it work!
Karl
actually, the null is ok I think. The array is wrong - you can't 'add'
an array to a scalar variable, which an integer or null is.
Yes, it is me and arrays again :D
$resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
$antall = mysql_num_rows($resultat);
for($i = 0; $i < $antall; $i++){
$rad = mysql_fetch_array($resultat, MYSQL_ASSOC);
and write it tis way can perhaps make someting more correct?
For example $variable[$i] ?
Karl
Not sure what your question is now. But - $rad will contain a single
row of values here, all in an array such as
$rad['field_name1'],$rad['field_name2'],$rad['field_name3'],.... .
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Loading...