Skip to content
Advertisement

SQL error when inserting a function variable

I try to use a value resulted from a 1st function as argument into a 2nd function, but SQL give me the error cannot be NULL

My 1st function :

My php who call the 2nd function :

My 2nd function :

Echo is ok, it print correctly my value, but trying to use it as argument for my 2nd function don’t work.

If I include $optionprix = “10” my 2nd function work fine.

Advertisement

Answer

You’re not actually returning the option price from your get_option_price function which is why $option_price is NULL. Add a return:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement