villas Posted February 25, 2006 Share Posted February 25, 2006 Hi ... newbie (and diferent language) calling here please be pacient!I need UPDATE a NEW table with data of OLD table (only 2 columns) in all table (1600 regs) comparing with another diferent columnThe script was an parser error in first UPDATE nd stop.[code]<?php require_once('../Connections/connNOR2.php'); ?><?php//----recordset (OLD table)-------------mysql_select_db($database_connNOR2, $connNOR2);$query_rsREAJUSTAtudoVELHA = "SELECT * FROM tab082005_2";$rsREAJUSTAtudoVELHA = mysql_query($query_rsREAJUSTAtudoVELHA, $connNOR2) or die(mysql_error());$row_rsREAJUSTAtudoVELHA = mysql_fetch_assoc($rsREAJUSTAtudoVELHA);$totalRows_rsREAJUSTAtudoVELHA = mysql_num_rows($rsREAJUSTAtudoVELHA);//----------------------------------$codTT=$row_rsREAJUSTAtudoVELHA['tab_cod'];$velha_hier=$row_rsREAJUSTAtudoVELHA['tab_hier'];//-----------------------------------//----recordset (NEW table)---------------mysql_select_db($database_connNOR2, $connNOR2);$query_rsREAJUSTAtudoNOVA = "SELECT * FROM tab01022006_2 WHERE tab_cod='$codTT'";$rsREAJUSTAtudoNOVA = mysql_query($query_rsREAJUSTAtudoNOVA, $connNOR2) or die(mysql_error());$row_rsREAJUSTAtudoNOVA = mysql_fetch_assoc($rsREAJUSTAtudoNOVA);$totalRows_rsREAJUSTAtudoNOVA = mysql_num_rows($rsREAJUSTAtudoNOVA);?><?php do { // put the "hhhh" and "eeee" where value is empty.if ($velha_hier==''){UPDATE tab01022006_2 SET tab_hier='hhhh',qtde_emb='eeee'; // <---PARSE ERROR ??} else {// put the OLD value in a NEW tableUPDATE tab01022006_2 SET tab01022006_2.tab_hier=$row_rsREAJUSTAtudoVELHA['tab_hier'], qtde_emb=$row_rsREAJUSTAtudoVELHA['qtde_emb'];}?><?php } while ($row_rsREAJUSTAtudoNOVA = mysql_fetch_assoc($rsREAJUSTAtudoNOVA)); ?><?php mysql_free_result($rsREAJUSTAtudoVELHA);mysql_free_result($rsREAJUSTAtudoNOVA);?>[/code]Thanks and sory about the englishVillas Quote Link to comment https://forums.phpfreaks.com/topic/3600-mysql-php-update-with-dowhile/ Share on other sites More sharing options...
fenway Posted February 26, 2006 Share Posted February 26, 2006 I see SQL code outside of quotes (i.e. in raw PHP), and not being ever sent to the server. That's bound to be the problem. Quote Link to comment https://forums.phpfreaks.com/topic/3600-mysql-php-update-with-dowhile/#findComment-12544 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.