Copy link to clipboard
Copied
Hi guys,
Probably an easy one:
I have a script.php page that creates a directory, made up of an Order Number and a Document Title.
The script.php page also has a Record set (rsProjects), which is filtered from a Form Variable (order).
What I need to happen is that if the MKDIR is sucessful, then UPDATE tbl_projects SET projdir='y' WHEN projid=colname ? ? ?
Here's the code:
(SCRIPT.PHP)
<?php
// URL
$url = "/Server/Folder1/Folder2/". $_POST['order']." ".$_POST['documentname'];
// Create It
$create = mkdir("$url");
mkdir("$url/Incoming");
mkdir("$url/Outgoing");
mkdir("$url/Work");
if($create)
{$mess = "<p>Directory created<p>"; }
else
{$mess = "<p>Directory could not be created, this may be due to the possibility of the directory already exisiting on the Server. Please check the Folder2 directory. Alternatively, contact the Administrator</p>"; }
?>
<?php require_once('../Connections/conndb2.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;
}
}
$colname_rsProjects = "-1";
if (isset($_POST['order'])) {
$colname_rsProjects = $_POST['order'];
}
mysql_select_db($database_conndb2, $conndb2);
$query_rsProjects = sprintf("SELECT * FROM tbl_projects WHERE projid = %s", GetSQLValueString($colname_rsProjects, "int"));
$rsProjects = mysql_query($query_rsProjects, $conndb2) or die(mysql_error());
$row_rsProjects = mysql_fetch_assoc($rsProjects);
$totalRows_rsProjects = mysql_num_rows($rsProjects);
?>
Copy link to clipboard
Copied
http://www.sitepoint.com/forums/showthread.php?t=633695&goto=newpost
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more