Skip to main content
Participant
April 8, 2010
Question

Create Recordset with Filter Error?

I'm checking with DWCS4 create Recordset, PHP6, MySQL 6 (I  checked with Appserv 2.6.0).

When  I create a recordset is not filtered, then run the result on normal  browser.

<?php require_once('../Connections/conn_shop.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $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_conn_shop, $conn_shop);
$query_rs_news = "SELECT ID_news, NewsHeading, NewsImage, NewsShortDesc FROM news ORDER BY NewsUpdateDate ASC";
$rs_news = mysql_query($query_rs_news, $conn_shop) or die(mysql_error());
$row_rs_news = mysql_fetch_assoc($rs_news);
$totalRows_rs_news = mysql_num_rows($rs_news);
?><!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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php echo $row_rs_news['NewsHeading']; ?>
</body>
</html>
<?php
mysql_free_result($rs_news);
?>



But when the Recordset is filtered, then  see the results on the browser error Apache HTTP Server has encountered a  problem and Needs to close.

<?php require_once('../Connections/conn_shop.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $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_rs_news = "-1";
if (isset($_GET['NewsCategoryID'])) {
  $colname_rs_news = $_GET['NewsCategoryID'];
}
mysql_select_db($database_conn_shop, $conn_shop);
$query_rs_news = sprintf("SELECT ID_news, NewsHeading, NewsImage, NewsShortDesc FROM news WHERE NewsCategoryID = %s ORDER BY NewsUpdateDate ASC", GetSQLValueString($colname_rs_news, "int"));
$rs_news = mysql_query($query_rs_news, $conn_shop) or die(mysql_error());
$row_rs_news = mysql_fetch_assoc($rs_news);
$totalRows_rs_news = mysql_num_rows($rs_news);
?>
<!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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php echo $row_rs_news['NewsHeading']; ?>
</body>
</html>
<?php
mysql_free_result($rs_news);
?>

Do not know why this problem is  when the filter is faulty?

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

DiDacTiko
Participant
October 6, 2010

The Development Area DREAMWEAVER not take into
account the radical changes from version 6 MySql.
Have nullified various functions and connection profiles
The user has no access to rewrite the syntax and
void get_magic_quotes_gpc () no longer forms part
of MySql 6
I propose that from FACEBOOK ask for massively
priority attention by ADOBE

Greetings from Lima Peru

North Lima News Agency

www.LimaNorte.com

LimaNorte.wordpress.com

Lima Norte - FaceBook - http://es-es.facebook.com/people/Prensa-Lima-Norte/1644856132

Translate