Undefined offset: 0 error

14 posts by 2 authors in: Forums > CMS Builder
Last Post: November 9, 2018   (RSS)

Thanks Daniel,

I'll give it a try.

I thought that might be an internal variable and was afraid to mess with it.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By gkornbluth - November 8, 2018 - edited: November 8, 2018

Hi Daniel,

Sorry this has become such a problem but there's no solution yet.

I changed the first $where to $where = mysql_escapef(" WHERE tableName = 'accounts' AND recordNum = ? AND num != ? AND fieldName = ?", $CURRENT_USER['num'], $newUploadNums[0], $uploadFieldName) ; // Daniel 11/7/18

and the second $where to $where = mysql_escapef(" WHERE tableName = 'accounts' AND recordNum = ? AND num != ? AND fieldName = ?", $CURRENT_USER['num'], $newUploadNums1[0], $uploadFieldName1); // Daniel 11/7/18

I was able to upload 2 images simultaneously when there were none uploaded.

Trying to upload a new image for either one deletes the other.

Here are the code blocks for removing images.

The first:

// remove upload files
$query = "SELECT * FROM `{$TABLE_PREFIX}uploads` $where";
$result = mysql_query($query) or die("MySQL Error: ". htmlspecialchars(mysql_error()) . "\n");
while ($row = mysql_fetch_assoc($result)) {
$files = array($row['filePath'], $row['thumbFilePath'], @$row['thumbFilePath2'], @$row['thumbFilePath3'], @$row['thumbFilePath4']);
foreach ($files as $filepath) {
if (!$filepath || !file_exists($filepath) || @unlink($filepath)) { continue; }

}
}
if (is_resource($result)) { mysql_free_result($result); }

// remove upload records
mysql_query("DELETE FROM `{$TABLE_PREFIX}uploads` $where") or die("MySQL Error: ". htmlspecialchars(mysql_error()) . "\n");
}

}

And the second:

/ remove upload files
$query1 = "SELECT * FROM `{$TABLE_PREFIX}uploads` $where";
$result1 = mysql_query($query1) or die("MySQL Error: ". htmlspecialchars(mysql_error()) . "\n");
while ($row1 = mysql_fetch_assoc($result1)) {
$files1 = array($row1['filePath'], $row1['thumbFilePath'], @$row1['thumbFilePath2'], @$row1['thumbFilePath1'], @$row1['thumbFilePath4']);
foreach ($files1 as $filepath1) {
if (!$filepath1 || !file_exists($filepath1) || @unlink($filepath1)) { continue; }

}
}
if (is_resource($result1)) { mysql_free_result($result1); }

// remove upload records
mysql_query("DELETE FROM `{$TABLE_PREFIX}uploads` $where") or die("MySQL Error: ". htmlspecialchars(mysql_error()) . "\n");
}

}

Thanks for sticking with this,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Hey Daniel,

That seems to have done the trick.

Thank you for all the help and encouragement.

It's really great working with people that have our backs.

Best,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php