kester Posted May 14, 2003 Posted May 14, 2003 Hello all.. I was wondering if anyone had the code to create a list (plain text) of products with the image missing (the image field is filled in with a file name but the file doesn't exist). Also, could this function/report be changed to list all products with the price field empty? I'm working with a few thousand products entries, so going through each one-by-one would take much too long. Any help is appreciated. ~k
kester Posted May 14, 2003 Author Posted May 14, 2003 if (isset($product_image) && __________________ ) { echo $product_model; } ____________ = file system command (product image exists)
kester Posted May 14, 2003 Author Posted May 14, 2003 i'm editting the stats_products_viewed.php report to accomplish the list, but i still don't know how to compare to the file system... pls hlp.
Druide Posted May 14, 2003 Posted May 14, 2003 use phpmyadmin or so and use this SQL query SELECT * FROM products WHERE products_image='' if you have the big images mod also installed then products_bimage SELECT * FROM products WHERE products_image='' || products_bimage = '' or write it into a file somewhere you need it tep_db_query(...); Robert We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;)
kester Posted May 15, 2003 Author Posted May 15, 2003 thanks for the reply druide, but the problem i'm having is not with the sql statement, it is isolating the broken image links.
josheli Posted May 15, 2003 Posted May 15, 2003 $q = mysql_query('select * from products'); while($p = mysql_fetch_array($q)){ //product image path in db, but no actual file if(isset($p['products_image']) && !file_exists('/home/user/www/catalog/'.$p['products_image'])) { echo $p['products_id'].' '.$p['products_model'].'<br>'; } //products price can't be null. check versus 0, the default; if($p['products_price'] == 0.0000) { echo $p['products_id'].' '.$p['products_model'].'<br>'; } }
kester Posted May 15, 2003 Author Posted May 15, 2003 thanks david .. what a simple fix. i had no clue the file_exists function existed..
kester Posted May 15, 2003 Author Posted May 15, 2003 thanks david .. what a simple fix. i had no clue the file_exists function existed..
Recommended Posts
Archived
This topic is now archived and is closed to further replies.