PriteshP23 Posted August 21, 2013 Share Posted August 21, 2013 This query is not working. I need urgent help. Thanks a lot in adv. ROWS affected: 0 I have cross checked the data in the table for the given condition. $sql = 'UPDATE LTE_noria_cellule cel_bk_up SET cel.NAP_'.$site->ur().' = \'1\' '. 'WHERE cel.nidt IN ( select gn from LTE_noria_candidat_bk_up can INNER JOIN LTE_noria_site_bk_up site ON (site.codesite = can.codesite) WHERE '.$site->get_param('zone_bde').')'; I believe problem is because of WHITESPACE. When i search "codesite" in the table with "LIKE". I can't find it. But when i did "LIKE%" , it's working. I tried this also but not working $sql = 'UPDATE LTE_noria_cellule cel_bk_up SET cel.NAP_'.$site->ur().' = \'1\' '. 'WHERE cel.nidt IN ( select gn from LTE_noria_candidat_bk_up can INNER JOIN LTE_noria_site_bk_up site ON trim(site.codesite) LIKE CONCAT('%',trim(can.codesite),'%') WHERE '.$site->get_param('zone_bde').')'; Quote Link to comment Share on other sites More sharing options...
PriteshP23 Posted August 21, 2013 Author Share Posted August 21, 2013 I have also tried: UPDATE LTE_noria_candidat_bk_up SET gn = TRIM(gn); UPDATE LTE_noria_candidat_bk_up SET codesite = TRIM(codesite); Still NOT WORKING.. I need to solve it urgent. Thanks in adv. Quote Link to comment Share on other sites More sharing options...
Barand Posted August 21, 2013 Share Posted August 21, 2013 Can you echo $sql; Then we can see what the query really looks like Quote Link to comment Share on other sites More sharing options...
PriteshP23 Posted August 22, 2013 Author Share Posted August 22, 2013 I run file with one parameter like: -->> php updateNap.php TO UPDATE LTE_noria_cellule cel_bk_up SET cel.NAP_TO = '1' (x>220000 AND x<910000 AND y>1473000 AND y<2460000)) Quote Link to comment Share on other sites More sharing options...
Barand Posted August 22, 2013 Share Posted August 22, 2013 You need the word "WHERE" in that query Quote Link to comment Share on other sites More sharing options...
PriteshP23 Posted August 22, 2013 Author Share Posted August 22, 2013 It is not in the query ? How to solve it ? Where is the error ? How to remove whitespace in CSV file with LOAD DATA INFILE ? It may works. Quote Link to comment Share on other sites More sharing options...
PriteshP23 Posted August 22, 2013 Author Share Posted August 22, 2013 You need the word "WHERE" in that query Here it is: TO<br>(x>220000 AND x<910000 AND y>1473000 AND y<2460000)<br><br>UPDATE LTE_noria_cellule cel_bk_up SET cel.NAP_TO = '1' WHERE cel.nidt IN ( select gn from LTE_noria_candidat_bk_up can INNER JOIN LTE_noria_site_bk_up site ON (site.codesite = can.codesite) WHERE (x>220000 AND x<910000 AND y>1473000 AND y<2460000)) Still NOT WORKING... :( Quote Link to comment Share on other sites More sharing options...
PriteshP23 Posted August 22, 2013 Author Share Posted August 22, 2013 This is CSV file of LTE_noria_site_bk_up Table.How to import by LOAD DATA INFILE ? GN;CODESITE;CANDIDAT;VERSION;ZDVIE;CAT_ARCEP;BLOC|$| 00000001B2;G003125;1;11;BORDEAUX;;6|$| 00000001B1;G003135;1;10;BORDEAUX;;1,2,3|$| Quote Link to comment Share on other sites More sharing options...
Barand Posted August 22, 2013 Share Posted August 22, 2013 When you run the update query, have you checked for the value in mysqli_error(), or the equivalent in whatever library you are using Quote Link to comment Share on other sites More sharing options...
PriteshP23 Posted August 22, 2013 Author Share Posted August 22, 2013 Yes, i just checked. There is no error. Quote Link to comment Share on other sites More sharing options...
Barand Posted August 22, 2013 Share Posted August 22, 2013 there should be an error message - you are trying to update cel.NAP_TO, but cel is not defined anywhere Quote Link to comment Share on other sites More sharing options...
Solution PriteshP23 Posted August 22, 2013 Author Solution Share Posted August 22, 2013 GURU...!! You are right..!! :) TO<br>(x>220000 AND x<910000 AND y>1473000 AND y<2460000)<br><br>UPDATE LTE_noria_cellule_bk_up cel SET cel.NAP_TO = '1' WHERE cel.nidt IN ( select gn from LTE_noria_candidat_bk_up can INNER JOIN LTE_noria_site_bk_up site ON (site.codesite = can.codesite) WHERE (x>220000 AND x<910000 AND y>1473000 AND y<2460000))TO<br>TO<br> Quote Link to comment 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.