Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Small SQL help


sefu

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...