Quote:
|
Originally Posted by dlite922 This is not the code that inserts it into the DB. This is the code used to display the form (textareas). |
Sorry
Here is everything I have of code to insert into the DB
[PHP]<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO announcements (ID) VALUES (%s)",
GetSQLValueString($_POST['Principal_Message'], "int"));
mysql_select_db($database_production, $production);
$Result1 = mysql_query($insertSQL, $production) or die(mysql_error());
$insertGoTo = "view_announcement.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO announcements (Principal_Message) VALUES (%s)",
GetSQLValueString($_POST['Principal_Message'], "text"));
mysql_select_db($database_production, $production);
$Result1 = mysql_query($insertSQL, $production) or die(mysql_error());
$insertGoTo = "result.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_production, $production);
$query_Recordset1 = "SELECT ID, Principal_Message FROM announcements";
$Recordset1 = mysql_query($query_Recordset1, $production) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>[/PHP]
Also, I misspoke earlier. I can ftp files to the server, what I cannot do is install anything to the root directory to the server. I have only ftp access to a sub-directory on the server. However I can use php and mysql to post data to tables in a database. But, I have to have the admin set up the db and tables.