My set-up is DW CS3, Mac OS 10.4.10, PHP 5, MySQL 5, testing
on localhost.
I have a PHP page created in DW CS3 that I know successfully
passes on a primary key of an populated MySQL table. When I pass
the primary key as a URL parameter in a text link from one page to
another page, I start having problems ONLY when I use the Server
Behavior panel to MODIFY the target RecordSet to Filter: ID to URL
Parameter: ID - this results in no data listed at all which
indicates to me that the recordset is not correctly reading the URL
Parameter. If I change the Filter setting to none, I have no
problems.
I don't know enough php or SQL code to debug. Please help.
Here's the DW code that reads the passed URL parameter with
no problem:
<?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;
}
}
mysql_select_db($database_artgallery, $artgallery);
$query_rsdelete = "SELECT * FROM ARTISTS ORDER BY ARTISTID
ASC";
$rsdelete = mysql_query($query_rsdelete, $artgallery) or
die(mysql_error());
$row_rsdelete = mysql_fetch_assoc($rsdelete);
$totalRows_rsdelete = mysql_num_rows($rsdelete);
?>
Here's the DW code that gives problems when setting the
RecordSet to Filter: ID to URL Parameter: ID
[CODE]
<?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_rsdelete = "-1";
if (isset($_POST['ARTISTID'])) {
$colname_rsdelete = $_POST['ARTISTID'];
}
mysql_select_db($database_artgallery, $artgallery);
$query_rsdelete = sprintf("SELECT * FROM ARTISTS WHERE
ARTISTID = %s ORDER BY ARTISTID ASC",
GetSQLValueString($colname_rsdelete, "int"));
$rsdelete = mysql_query($query_rsdelete, $artgallery) or
die(mysql_error());
$row_rsdelete = mysql_fetch_assoc($rsdelete);
$totalRows_rsdelete = mysql_num_rows($rsdelete);
?>
[/CODE]