Re: Opening a file outside of the root
Hmmmm. I must have something else wrong.
1. Looked at dreamweaver site manager settings, everything "looks" ok there.
2. Tried using a stand alone ftp program (smartFTP) to put the folder outside the root. However, it failed to put it there. I'm a regular user of smartFTP so I know how to use the program. Just got a "transfer failed" message every time I attempt it.
3. Tried putting the complete root path replacing the "../" but still nothing.
4. Finally broke down and put the folder in the root folder and changed the link, and to my surprise, still nothing.
This leads me to believe it may not be the path to the connections folder. Perhaps the generated code is not correct. *pulls hair out*
Damn this PHP (lol). It's just a simple site search engine to get my feet wet and I can't even get this correct!!!
Anywho.... here is the code.
<?php require_once('../Connections/mydatabase.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;
}
}
$maxRows_simpleSearch = 10;
$pageNum_simpleSearch = 0;
if (isset($_GET['pageNum_simpleSearch'])) {
$pageNum_simpleSearch = $_GET['pageNum_simpleSearch'];
}
$startRow_simpleSearch = $pageNum_simpleSearch * $maxRows_simpleSearch;
$colname_simpleSearch = "-1";
if (isset($_GET['keywords'])) {
$colname_simpleSearch = (get_magic_quotes_gpc()) ? $_GET['keywords'] : addslashes($_GET['keywords']);
}
mysql_select_db($database_continental, $continental);
$query_simpleSearch = sprintf("SELECT PR_SKU, PR_Description, PR_ProductTextFile FROM PRODUCTS WHERE PR_Description LIKE CONCAT('%%', %s, '%%')", GetSQLValueString($colname_simpleSearch, "text"));
$query_limit_simpleSearch = sprintf("%s LIMIT %d, %d", $query_simpleSearch, $startRow_simpleSearch, $maxRows_simpleSearch);
$simpleSearch = mysql_query($query_limit_simpleSearch, $continental) or die(mysql_error());
$row_simpleSearch = mysql_fetch_assoc($simpleSearch);
if (isset($_GET['totalRows_simpleSearch'])) {
$totalRows_simpleSearch = $_GET['totalRows_simpleSearch'];
} else {
$all_simpleSearch = mysql_query($query_simpleSearch);
$totalRows_simpleSearch = mysql_num_rows($all_simpleSearch);
}
$totalPages_simpleSearch = ceil($totalRows_simpleSearch/$maxRows_simpleSearch)-1;
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<table border="1">
<tr>
<td>PR_SKU</td>
<td>PR_Description</td>
<td>PR_ProductTextFile</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_simpleSearch['PR_SKU']; ?></td>
<td><?php echo $row_simpleSearch['PR_Description']; ?></td>
<td><?php echo $row_simpleSearch['PR_ProductTextFile']; ?></td>
</tr>
<?php } while ($row_simpleSearch = mysql_fetch_assoc($simpleSearch)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($simpleSearch);
?>
Thanks everyone. Wish I could figure this out on my own.
DaK
|