Okay this will be my last post here for today, have asked you guys enougth questions about why my terrible code dosnt work :)
I am trying to run a query to update all values of a column with a text documents contents. My database looks like follows:
Attribute_id | value
64 | Data.txt
109 | other data
64 | Data2.txt
109 | other data
If you look at my script you can see what I am trying to do, for now I am echoing the query the end result is here: http://dev.central-pet-supplies.co.uk/test.php
it is returning UPDATE mage_catalog_product_entity_text SET value= 'Array' WHERE value = '13685.txt' however array should be the text files contents
Here is the script:
<?php
mysql_connect ("localhost","cpsdev_mage1","********");
mysql_select_db ("cpsdev_mage1");
$sql = "select value from mage_catalog_product_entity_text WHERE Attribute_id = 64";
$result = mysql_query ($sql) or die($myQuery."<br/><br/>".mysql_error());
while($row = mysql_fetch_array($result,MYSQL_ASSOC))
{
$lines = file('http://dev.central-pet-supplies.co.uk/media/import/' . $row['value']);
$query3 = "UPDATE mage_catalog_product_entity_text " . " SET value= '" . $lines . "' WHERE value = '" . $row['value'] . "'";
echo $query3 ."<br>";
}
?>
Edit: changed file to file_get_contents and now working.