Hi. I have a MySQL table set up which has one field (column) that stores a multiple values (of SET type):
Uk-wide, England, Scotland, Wales, Northern Ireland
I am having difficult creating an sql insert query to send values into this table via php.
My Current Query is able to send other values into the other field types that are just text or int's but I cannot send predefine values into the 'SET' type field. When I manage to get it half working it only choose one of the values.
The predfine values could either be displayed in a form via checkbox's or a list in a text area.
Does any know where I am going wrong? Do I need to create two seperate queries?
Attached code as follows:
Attach Code
php to code
....
$editFormAction = $SERVER['PHP_SELF'];
if (isset($SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($POST["MM_insert"])) && ($POST["MM_insert"] == "updateForm")) {
$insertSQL = sprintf("INSERT INTO rcm_news (title, issue_date, content, region) VALUES (%s, %s, %s, %s)",
GetSQLValueString($POST['textfield2'], "text"),
GetSQLValueString($POST['textfield3'], "date"),
GetSQLValueString($POST['textarea'], "text"),
GetSQLValueString($POST['region'], "text"));
mysql_select_db($database_rcmconnect, $rcmconnect);
$Result1 = mysql_query($insertSQL, $rcmconnect) or die(mysql_error());
$insertGoTo = "newsview.php";
if (isset($SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
...............
form code
.......
<td colspan="15"><select name="region[]" size="4" multiple="MULTIPLE" tabindex="5" onchange="return unNullify('region')" >
<option value="UK-wide">UK-wide</option>
<option value="England">England</option>
<option value="Scotland">Scotland</option>
<option value="Wales">Wales</option>
<option value="Northern+Ireland">Northern Ireland</option>
</select></td>
. . . . . . :bemused: