Simple database search problem

Ask a Question related to Macromedia Dynamic HTML, Design and Development.

  1. #1

    Default Simple database search problem

    I'm trying to setup a simple database search, however when I test the page, the
    search yields all the records in the database. Connection to MySQL database is
    working. I have a search page with a simple html form using GET and then a PHP
    page for the results. It's as if the database isn't recognizing the search
    parameter??? I'm new to working with dynamic pages, so any advice would be
    appreciated! Thanks in advance...

    mariahoeppner Guest

  2. Similar Questions and Discussions

    1. create a simple search
      Simple search... Can any one give me how to start a basic search in cf.? The directory I want to search through is on another server.. Any help...
    2. Problem with Database Search
      Hi, I am trying to repair a website's directory search but can't pinpoint the problem(s). Basically, when I input a person's full name, the...
    3. simple search
      Please help i have dreamweaver mx and mysql,php4,apache. i need to make a search page that a person adds keywords and it searches 1 table with the...
    4. simple search option ???
      I'd like to achieve the following: one simple search form on my website (so only one textfield) where users could put in one keyword, ie the...
    5. simple search database question
      can anyone point me in the right direction as how to create a search page that users can type into to pull up matching records from my database, im...
  3. #2

    Default Re: Simple database search problem

    Can you post your code?


    both the form code and the .php page

    tecknowjnkie Guest

  4. #3

    Default Re: Simple database search problem

    Form Code:

    <form action="interchangeresults.php" method="get"
    enctype="application/x-www-form-urlencoded" name="search" id="search">
    <input name="searchkey" type="text" id="searchkey">
    <INPUT name="Searchbut" TYPE="submit" id="Searchbut" VALUE="Search">
    </form>

    PHP:

    <?php require_once('Connections/connSBI.php'); ?>
    <?php
    $maxRows_rsResults = 50;
    $pageNum_rsResults = 0;
    if (isset($_GET['pageNum_rsResults'])) {
    $pageNum_rsResults = $_GET['pageNum_rsResults'];
    }
    $startRow_rsResults = $pageNum_rsResults * $maxRows_rsResults;

    mysql_select_db($database_connSBI, $connSBI);
    $query_rsResults = "SELECT * FROM Interchange WHERE PartNo LIKE '%s' OR Comp
    LIKE '%s' OR CompPartNo LIKE '%s' ORDER BY PartNo ASC";
    $query_limit_rsResults = sprintf("%s LIMIT %d, %d", $query_rsResults,
    $startRow_rsResults, $maxRows_rsResults);
    $rsResults = mysql_query($query_limit_rsResults, $connSBI) or
    die(mysql_error());
    $row_rsResults = mysql_fetch_assoc($rsResults);

    if (isset($_GET['totalRows_rsResults'])) {
    $totalRows_rsResults = $_GET['totalRows_rsResults'];
    } else {
    $all_rsResults = mysql_query($query_rsResults);
    $totalRows_rsResults = mysql_num_rows($all_rsResults);
    }
    $totalPages_rsResults = ceil($totalRows_rsResults/$maxRows_rsResults)-1;
    ?>




    mariahoeppner Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139