MySQL Forums :: PHP :: IF syntax

Advanced Search

IF syntax
Posted by: David Maralík ()
Date: August 31, 2008 08:34AM

Hello, please, help me...
What is wrong on this query?

$dotaz = "IF((SELECT COUNT(*) AS pocet FROM jos_product WHERE kod_zbozi = '".$kod_zbozi."') = 0, , INSERT INTO jos_vm_product_parametry ( parametr_publish, nazev, hodnota, kod_zbozi, poradi, editovano ) VALUES ( 1, IF((SELECT COUNT(*) AS pocet FROM jos_atc_parametry_kody WHERE kod = '".$kod_parametru."') = 0,'".$kod_parametru."' , (SELECT nazev FROM jos_atc_parametry_kody WHERE kod = '".$kod_parametru."')) , '".$hodnota."', (SELECT product_id FROM jos_vm_product WHERE kod_zbozi = '".$kod_zbozi."' ), 99, 'ne' ));";

the query send me this error mesage:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF(((SELECT COUNT(*) AS pocet FROM jos_product WHERE kod_zbozi = '2055149105') =' at line 1

Thank you very much!

(and sory for my bad english :-\ )

Options: ReplyQuote

Subject Written By Posted
IF syntax David Maralík 08/31/2008 08:34AM
Re: IF syntax Rick James 08/31/2008 11:09PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.