Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
mariahoeppner #1
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
-
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... -
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... -
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... -
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... -
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... -
tecknowjnkie #2
Re: Simple database search problem
Can you post your code?
both the form code and the .php page
tecknowjnkie Guest
-
mariahoeppner #3
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



Reply With Quote

