Re: If( Query)

From: Date: Mon, 08 Sep 2008 15:56:54 +0000
Subject: Re: If( Query)
References: 1 2 3 4 5  Groups: php.db 
Request: Send a blank email to php-db+get-45376@lists.php.net to get a copy of this message
Do a print on the query: >> function editproduct($item_id, $item_name, $item_desc, $item_price, >> $item_pix, $item_man_id, $item_cat_id) { >> $item_id = mysql_real_escape_string($item_id); >> $item_name = mysql_real_escape_string($item_name); >> $item_desc = mysql_real_escape_string($item_desc); >> $item_price = mysql_real_escape_string($item_price); >> $item_pix = !empty($item_pix) ? mysql_real_escape_string($item_pix) >> : null; >> $item_man_id = mysql_real_escape_string($item_man_id); >> $item_cat_id = mysql_real_escape_string($item_cat_id); >> connect(); >> $sql = "UPDATE items SET item_name='{item_name}', >> item_desc='{item_desc}', item_price='{item_price}', " . >> (!empty($item_pix) ? "item_pix='{item_pix}', " : "") . >> "item_man_id='{item_man_id}', item_cat_id='{item_cat_id}' WHERE >> item_id={$item_id}"; var_dump($sql); >> mysql_query($sql) or die('Insert failed: ' . mysql_error()); >> }

« previous php.db (#45376) next »