Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

delete from products_notifications table


leveera

Recommended Posts

Posted

Trying to write a script deleting records from products_notifications table where we have

products_id

customers_id

date_addded

 

The script I applying seems is wrong but it gives no error message and no delete

Any help or hints are welcome

 

// delete notification start
 if (tep_not_null($action)) {
   switch ($action) {
     case 'remove':
$customers_id = tep_db_prepare_input($customers['customers_id']);
$products_id = tep_db_prepare_input($_GET['pID']);
       tep_db_query("DELETE FROM" . TABLE_PRODUCTS_NOTIFICATIONS . "WHERE customers_id = '" . (int)$customers_id . "' AND products_id ='". (int)$products_id ."'");
			tep_redirect(tep_href_link(FILENAME_STATS_PRODUCTS_NOTIFICATIONS,'NONSSL'));
       break;

     default:
   }
 }
// delete notification end

 

 

<td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_NOTIFICATIONS, 'cID='. $customers['customers_id']. '&pID=' . $_GET['pID'].'action=remove') . '">' . tep_image(DIR_WS_ICONS . 'delete.gif', IMAGE_ICON_DELETE) . '</a>';?></td>

 

if to test by echo $customers['customers_id'] and echo $products_id it displays correct ids

 

Thanks

Sergei

Posted

The script I applying seems is wrong but it gives no error message and no delete

But it looks like the query will be DELETE FROMproducts_notificationsWHERE customers_id etcetera which doesn't mean anything.

Posted

...which doesn't mean anything.

 

OK... let me simplify

 

<td class="dataTableContent"><?php echo '<a href="stats_products_notifications.php?delete&cID='. $customers['customers_id']. '&pID=' . $_GET['pID'].'">' . tep_image(DIR_WS_ICONS . 'delete.gif', IMAGE_ICON_DELETE) . '</a>';?></td>

 

The result string for example is

.../stats_products_notifications.php?delete&cID=14&pID=92

 

How to write correct delete script using this query?

 if (isset($_GET['delete'])) {
           mysql_query("DELETE FROM products_notifications WHERE customers_id =". ...... ."AND products_id =". ......);     
 }

Posted

OK... let me simplify

 

How to write correct delete script using this query?

You need spaces between the words. DELETE FROM products_notifications WHERE customers_id

 

tep_db_query("DELETE FROM " . TABLE_PRODUCTS_NOTIFICATIONS . " WHERE customers_id = '" . (int)$customers_id . "' AND products_id ='". (int)$products_id ."'");

Posted

You need spaces between the words. DELETE FROM products_notifications WHERE customers_id

 

tep_db_query("DELETE FROM " . TABLE_PRODUCTS_NOTIFICATIONS . " WHERE customers_id = '" . (int)$customers_id . "' AND products_id ='". (int)$products_id ."'");

 

Very strange advice... anyway it doesn't work

Thanks for attempt!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...