Ir para conteúdo
Fórum Script Brasil

jfreitas

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Sobre jfreitas

jfreitas's Achievements

0

Reputação

  1. jfreitas

    Update não funciona

    Pessoal, O update simplesmente não funciona.... Alguém pode me ajudar? $sql = 'SELECT ordd.order_number, prodd.name as product_name, ordd.amount, ord.un, ordd.desconto, IF(ordd.desconto >0, (ordd.amount*(ordd.price-ordd.desconto)),(ordd.amount*ordd.price)) as units_total_price, ordd.price as unit_price, products.sku, ordd.id, products.icon_thumb FROM '.TABLE_ORDERS_ORCAR_DESCRIPTION.' ordd INNER JOIN '.$this->tableName.' ON ordd.order_number = '.$this->tableName.'.order_number INNER JOIN '.TABLE_PRODUCTS_DESCRIPTION.' prodd ON ordd.product_id = prodd.product_id INNER JOIN '.TABLE_PRODUCTS.' products ON ordd.product_id = products.id INNER JOIN '.TABLE_ORDERS_ORCAR.' ord ON ord.order_number = ordd.order_number LEFT OUTER JOIN '.TABLE_CURRENCIES.' cur ON '.$this->tableName.'.currency = cur.code LEFT OUTER JOIN '.TABLE_CUSTOMERS.' cust ON '.$this->tableName.'.customer_id = cust.id WHERE '.$this->tableName.'.'.$this->primaryKey.' = '.(int)$oid.' AND prodd.language_id = \''.$language_id.'\' '; if($this->customer_id != ''){ $sql .= ' AND cust.id = '.(int)$this->customer_id; } $result = database_query($sql, DATA_AND_ROWS, ALL_ROWS, FETCH_ASSOC); if($result[1] > 0){ $output .= '<form action="" method="post"><table width="100%" dir="'.Application::Get('lang_dir').'" border="0" cellspacing="0" cellpadding="3" style="border:1px solid #d1d2d3">'; $output .= '<tr style="background-color:#e1e2e3;font-weight:bold;font-size:13px;"> <th align="center" > # </th> <th align="center" width="60px">Código </th> <th align="center" width="40px">Imagem</th> <th align="left" width="390px">'._PRODUCT.'</th> <th align="center" width="180px"> '._UNIT_PRICE.' </th> <th align="center" width="180px"> Desconto </th> <th align="center" width="90px"> Qtde </th> <th align="right" width="90px"> '._TOTAL.' </th> </tr>'; for($i=0; $i < $result[1]; $i++){ $output .= '<tr>'; $output .= ' <td align="center" width="40px">'.($i+1).'.</td>'; $output .= ' <td align="center">'.$result[0][$i]['sku'].' </td>'; $output .= ' <td align="center"><img src="images/products/'.$result[0][$i]['icon_thumb'].'" width="30px" height="30px"/> </td>'; $output .= ' <td align="left">'.$result[0][$i]['product_name'].' </td>'; $output .= ' <td align="center">'.Currencies::PriceFormat($result[0][$i]['unit_price'], '', '', $this->currency_format).'</td>'; $output .= ' <td align="center"><input type="numeric" name="desconto" value='.$result[0][$i]['desconto].'></td>'; $output .= ' <td align="center">'.$result[0][$i]['amount'].'</td>'; $output .= ' <td align="right">'.Currencies::PriceFormat($result[0][$i]['units_total_price'], '', '', $this->currency_format).'</td>'; $output .= '<td align="right"><input class="form_button" type="submit" name="submit" value="'._BUTTON_UPDATE.'"></td>'; $output .= '</tr>'; } $output .= '</table></form>'; } return $output; if(isset($_POST['submit'])) { $des = $_POST['desconto']; $id = $result[0][$i]['id']; $q = database_query("UPDATE apsc_orders_orcar_description SET desconto = {$des} WHERE id={$id}"); }
×
×
  • Criar Novo...