-1

I try to update a mysql db using php.
I need to update the data in table "A" with the data from table "B" if the two table have 1 data in common.

Everithing works fine when the data in common (prod='$col[0]') are only 1 word but not work when the words are two or more.

I am not a expert and probably the solution is around the corner can anyone help me save a big headache.

This is the script:

<?php 
  $result = mysql_query("SELECT * FROM tableA");
  $row = mysql_fetch_array($result);
  
  $col=array ($row['Prod'],$row['a'],$row['b'],$row['c'],$row['d'],$row['e']);
  
  mysql_query("UPDATE tableB SET a=$col[1], b='$col[2]', c=$col[3], d=$col[4], e=$col[5]    
  WHERE Prod='$col[0]'");
  ?>
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by pritaeas
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.