Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Filtering results from a recordset

New Here ,
Apr 22, 2011 Apr 22, 2011

HELP - I have created  search page and a results page.  Everything I have set up seems in order.  On my search page I have used the GET option, have named my form object "list" and created a link to the results page and created my labels and values.  However, when i create a recordset on the results page and put a filter in it to select only certain words from one column in the results it either does not show up any results or shows a blank white page in live view.   I have now spent days trying to fix this problem and am not nearer to an answer.   I have used the URL parameter option on the filter list in the recordset set up screen, and made sure that i have the correct spelling etc for the name of my form object on the search page.  When i click test - it comes up with all the right results but when i put all the fields into a table on the results page nothing shows up or now I have a completely blank white screen.  If i put none in the filter box and click live view all my results show up.  HELP PLEASE - ANYONE

TOPICS
Server side applications
636
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 22, 2011 Apr 22, 2011

Mind readers might be able to help you. For an accurate response others will need your server side scripting language (unmentioned = fail) and your code.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 22, 2011 Apr 22, 2011

sorry - first time in trying to build a website and all this is new to me.  Am using PHP in dreamweaver.  Also using SQL for databases.  Would you need to see code from both search and result pages?  Any advice would be gratefully received. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 22, 2011 Apr 22, 2011

The query from the results page should suffice. Looking for code similar to SELECT column_name1, column_name2 FROM table_name WHERE....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 23, 2011 Apr 23, 2011

Have set up new page using a template and started from scratch - i can still only get the full list to display and when I apply a filter it will not show on the screen in live view - the test in the recordset set up still works.  The code i have for the page is:-

<?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_rsjob = "-1";

if (isset($_GET['Position'])) {

  $colname_rsjob = $_GET['Position'];

}

mysql_select_db($database_laura, $laura);

$query_rsjob = sprintf("SELECT * FROM jobs WHERE `Position` = %s", GetSQLValueString($colname_rsjob, "text"));

$rsjob = mysql_query($query_rsjob, $laura) or die(mysql_error());

$row_rsjob = mysql_fetch_assoc($rsjob);

$totalRows_rsjob = mysql_num_rows($rsjob);

$query_rsjob = "SELECT * FROM jobs";

$rsjob = mysql_query($query_rsjob, $laura) or die(mysql_error());

$row_rsjob = mysql_fetch_assoc($rsjob);

$totalRows_rsjob = mysql_num_rows($rsjob);

?>

any ideas?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 23, 2011 Apr 23, 2011
LATEST

I'll risk sticking my foot in my mouth since I don't know php by only stating that it appears you are defining the recordset sql and execute code twice - once here

$query_rsjob = sprintf("SELECT * FROM jobs WHERE `Position` = %s", GetSQLValueString($colname_rsjob, "text"));

and again here

$query_rsjob = "SELECT * FROM jobs";

Remove all 4 lines from the second recordset.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines