mysql - how to update just one column of a table by csv using php -


I have used the following code to update a column of a table, but it will also have the values ​​of the other columns Removes, I could not find the reason to please while ($ data = fgetcsv ($ handle, 1000, ","))! == incorrect) {if ($ data [0] == 'NULL') {$ import = "UPDATE tst_stores SET store_image_url = 'http: //admin.showcasejewellers.com.au/uploads/default_store.jpg'"; } And {$ import = "update tst_stores SET store_image_url = 'http://admin.showcasejewellers.com.au/uploads/". Mysql_real_escape_string ($ data [0]). ".jpg '"; } Mysql_query ($ import) or die (mysql_error ()); } Fclose ($ handle);

Your SQL query is incorrect You must specify that For which example you want to use the WHERE section by using the row

  update tst_stores SET store_image_url = 'http://admin.showcasejewellers.com. Au / uploads / default_store.jpg 'where tst_stores.id = 10;   

This will only update the row where the column is equal to ID 10.

Note: I have the column tst_stores received in the id column and the primary key is you have to change accordingly

Just look forward to reading it to see it.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -