Hello,
I've wound up with a strange problem with my php script. The script goes into a SQL DB and checks the values of two different columns to see if they are equal.
If the columns are not equal, then I store all of the possible values in column 1 in an array. The values from that array are meant to be placed into column 2.
What I've written works almost correctly. The problem, which has already consumed 8hrs of time, is that only the last value of the array is stored in column 2.
I've imploded the array and stored the values as a string in a new variable which is referenced by the SQL update. No luck.
Any help is GREATLY appreciated. Here's the code:
<?
//DB connection info here
$query = "SELECT DISTINCT special FROM julib.subscriber_sub_ml_events";
$query2 = "SELECT special FROM julib.subscriber_sub_ml_events WHERE sub_id = 644546";
$currentspecial = @mysql_query($query);
$currentsub = @mysql_query($query2);
if($currentspecial != $currentsub) {
echo '<p><b>Not synched</b></p>';
while($row = mysql_fetch_array($currentspecial,MYSQL_NUM)) {
$DBvalues = implode(',' , $row);
echo $DBvalues; //Print out the array to ensure it's all there.
mysql_query("UPDATE subscriber_sub_ml_eventsCBbackup SET special= '$DBvalues' WHERE sub_id = 644546"); //Update the DB record
}
}
//Results in last value of array being stored in DB. Argh.
?>