I have a query that takes some file names from a database based on Order_ID. Many files might be associated with one order. The query looks like
$download2 = xtc_db_query("SELECT orders_products_filename FROM orders_products_download WHERE orders_id='".$last_order."'");
while ($activated2 = xtc_db_fetch_array($download2))
{
$file = $activated2['orders_products_filename'];
$pieces = explode(".zip", $file);
print_r ($pieces);
if(file_exists($pieces.'.zip'))
{ echo "1"; }
if(!file_exists($pieces.'.zip'))
{ echo "2"; }
}
What I want to do is fire an action if the file exists or not. As $pieces is an array file_exists assumes the whole array is a file and it does not work (it always echoes 2). It would be great if someone gives me a hint how to fix that.
var_dump($pieces)? Does it contain only one file than you can access it by$pieces[0]or else you will need a loop.