PHP Example for Subscriber List: Difference between revisions
Jump to navigation
Jump to search
ELQ Homewood (talk | contribs) Created page with 'Something like.. <pre> <?php //db connect variables $host = "mysql server address"; $user = "mysql username"; $pw = "mysql password"; $db = "mysql database name"; //connect to d...' |
ELQ Homewood (talk | contribs) No edit summary |
||
| Line 33: | Line 33: | ||
//return to script | //return to script | ||
echo $ | echo $cm." complete."; | ||
?> | ?> | ||
</pre> | </pre> | ||
This isn't tested or anything but it should be pretty close, to give an idea what your list-building functions would look like. | This isn't tested or anything but it should be pretty close, to give an idea what your list-building functions would look like. | ||
Revision as of 19:53, 1 November 2009
Something like..
<?php
//db connect variables
$host = "mysql server address";
$user = "mysql username";
$pw = "mysql password";
$db = "mysql database name";
//connect to db
$con = mysql_connect($host,$user,$pw);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($db, $con);
//get variables from script
$uuid = $_REQUEST['UUID'];
$cm = $_REQUEST['command'];
//process variables
switch($command) {
case "add":
if(!mysql_query("SELECT * FROM tbl_News WHERE uuid = '$uuid'")) {
mysql_query("INSERT INTO tbl_News VALUES ('$uuid')");
}
break;
case "rem":
mysql_query("DELETE FROM tbl_News WHERE uuid='$uuid'");
break;
}
//return to script
echo $cm." complete.";
?>
This isn't tested or anything but it should be pretty close, to give an idea what your list-building functions would look like.