Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
I'm not sure whats wrong with this code? It works when it's in a normal page (or in the module itself) but when it's written into a .install file - it just refuses to work...?
function tablemanager_update_3() {
$items = array();
$row = array();
$sql = db_query("SELECT tm.tid, tm.header FROM {tablemanager} tm ORDER BY tm.tid ASC");
while ($fetch = db_fetch_object($sql)) {
$count = 1;
$temp = unserialize($fetch->header);
foreach ($temp as $a) {
if (is_array($a)) {
if (array_key_exists('field', $a)) {
$a['field'] = (string)($count);
} // end if (array_key_exists)
} // end if (is_array)
$row[] = $a;
$count++;
} // end foreach
$items[] = update_sql("UPDATE {tablemanager} tm SET header='%s' WHERE tm.tid=%d", serialize($row), $fetch->tid);
unset($row);
} // end while
return $items;
}
It also displays literally "UPDATE {tablemanager} tm SET header='%s' WHERE tm.tid=%d" as the output for each table you have rather than the actual output with the serialized strings. If I put the strings directly into the query rather than use '%s' and '%d' then (as expected) the curly brackets get stripped from the string when its put into the db.
Any eta on when this will be ready? I have a site I need to finish up in the next couple of days and it depends on multiple image uploads since the user will be uploading 30 photo sets daily.
This is just a suggestion... but it would be very nice if could be an area on the index page, or maybe at the "modules" page, or "downloads" page where we could see the last updates/added modules on the site.
I´ve searched for it and didn´t find it... maybe it is out there and I´m wasting your time asking for this... (in this case, please tell me where it is ;-)