Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Small SQL help


sefu

Recommended Posts

Posted

I want to test the HTML newsletter on the new server which I have just obtained. The only way I can think to test it without sending to all our customers is to change the status of customers subscribed to the newsletter from status 1 to status 2 in the database and change my status back to 1 for testing

What is the SQL command used for PHPMyAdmin to change the status of customers newsletters from 1 to 2?

 

Thanks in advance

Posted

You can use this little php script:

 

 

<?

$db=mysql_connect("localhost","username","password") or die("Database Connect Error");

mysql_select_db("database_name",$db);



$update_sql="update IGNORE customers set customers_newsletter='2'";

$update_result=mysql_query($update_sql) or die ("cant update customers");

}

?>

 

One question, should it not be set to "0" rather than "2"? I just tested it on mine, and with the value at 2, everyone is subscribed, with the value at 0, everyone is unsubscribed.

Unexpect the Expected

Posted

Thanks I give it a try.

 

If i set the subscribed users to 0, i will not know which subscribers were originally on status 1 thus putting it on 2 :)

Posted

don't execute the code as shown, then - that will change everyone - just a sec, I'll have revised code for you.....

Unexpect the Expected

Posted

hang on, doesnt this change the status os everyone to 2?

i only want to change the status of customers who are currently on 1 (subscribed) to 2

Posted

use this instead:

 

	$update_sql="update IGNORE customers set customers_newsletter='2' WHERE customers_newsletter='1'";

$update_result=mysql_query($update_sql) or die ("cant update customers");

Unexpect the Expected

Posted

You can use this little php script:

 

 

<?

$db=mysql_connect("localhost","username","password") or die("Database Connect Error");

mysql_select_db("database_name",$db);



$update_sql="update IGNORE customers set customers_newsletter='2'";

$update_result=mysql_query($update_sql) or die ("cant update customers");

}

?>

 

One question, should it not be set to "0" rather than "2"? I just tested it on mine, and with the value at 2, everyone is subscribed, with the value at 0, everyone is unsubscribed.

Unexpect the Expected

Archived

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

×
×
  • Create New...