Site search using several database tables

I am able to search my site for certain keywords using a single database table for example I can search for the butterflies using butterflies search table list. However I would like to have a global search for all types of wild animals on my ex of site from visitors to the homepage can search all species with the word Green in the name. If the search function needs to look at a range of tables, for example floralist; fungilist etc. I have problems with the sort code - I'm a bio-scientist a programmer so any suggestions would be appreciated.

Here is my code for the search using a single table:

  <?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_search11 = "-1";
if (isset($_POST['species'])) {
  $colname_search11 = $_POST['species'];
}
mysql_select_db($database_cjwebsite, $cjwebsite);
$query_search11 = sprintf("SELECT * FROM `moths searchl ist` WHERE species LIKE %s", GetSQLValueString("%" . $colname_search11 . "%", "text"));
$search11 = mysql_query($query_search11, $cjwebsite) or die(mysql_error());
$row_search11 = mysql_fetch_assoc($search11);
$totalRows_search11 = mysql_num_rows($search11);
?>


followed by:

<div class="results">
      <?php do { ?>
        <ul>
          <li><a href="Insects/Moths/species.php?id=<?php echo $row_search11['id']; ?>"><?php echo $row_search11['species']; ?></a></li>
        </ul>
        <?php } while ($row_search11 = mysql_fetch_assoc($search11)); ?>
      </ul>


My address is www.hebridensis.co.uk

Thank you

Christine

Hi Chris,

If the fields are basically the same for all the tables, seems, it would be better to merge them into a single table of "wildlife" and add a field "category", in this way you only ever have to query this table even if several categories are added, each record would have a unique id, and you could open up opportunities to do research with no dependents drop-down menus (i.e. a drop down menu allows the user to select) a category and then will fill up with the category-based species).

It wouldn't be too hard to create the new table, but I wonder how many other elements of your site could be affected by the change.

Hope this helps,

Greg

Tags: Dreamweaver

Similar Questions

  • Unable to connect to a Web site? used several times before. says the dns server is incorrect or does not exsist?

    Unable to connect to a Web site? used several times before. says the dns server is incorrect or does not exsist? help someone?

    If it is hosted by GoDaddy, it's maybe out of service. There is a DDoS (denial of Service) attack to GoDaddy for the moment.

    You could try again later and see if it returns.
  • Dyanamic form generation using the database Table

    I have a very difficult to explain the problem with the symbol # in a cfinput tag. Please bare with me while I try to explain.


    I have a form of update that has about 50 entry fields, types, ranging from 'text', 'text area', 'select', to hidden.

    Rather than hardcode the cfml use 50 different cfinputs, I have decided to hold the input names, labels, types and values in a table SQL server.

    My code reads as follows:
    < cfform >
    < cfloop query = "myformquery" >
    < b >
    < cfoutput >
    #myformquery.input_name # < td > < table >

    < cfif #myformquery.input_type # EQ "TEXT" >
    "< td > < cfinput type =" "#myformquery.input_type #" name = "#myformquery.input_name #" value="##mysavedrecords.#myformquery.input_name###"/ > < table >


    < cfelseif... for the text box / select / and hidden

    < / cfoutput >
    < /tr >
    < / cfloop >
    < cfform >


    myformquery is an application declared before the construction of this form. It reads data from a table 'INPUTS', which holds information on the entries in forms.

    mysavedrecord is a query declared before this form and read the table "RECORDS". This table contains the names of columns that correspond to the input names. DOCUMENTS IE. ADDRESS corresponds to the ENTRIES. Nom_entree = 'address '.

    You will probably see, the problem is that the value attribute is not analysis (code in italic).

    The desired output would be something like this
    < td > < input name = "address" type = "text" value = "123 Street" / > < table >

    Instead is the result I get
    < td > < input name = "address" type = "text" value = "#mysavedrecords.address #" / > < table >

    First of all, in this kind of situation, a switch/case statement would be probably much more effective than an if / ifelse / else statement:

    i.e.

    manage the type of text field
    manage the type of text box
    hidden type handle
    malleable unknown types

    regarding the syntax you, you cannot dynamically evaluate coldfusion variables in the way that you want. Try:

    #Evaluate ("mysavedrecords" & myformquery.input_name) #.

    Hope that helps.

  • Perform a search using several 'Types '.

    I looking for a file with specific content, say:

    content: qwerty

    and I would like to be able to search through two different types of files, for example, .rtf, and .txt

    I do this:

    content: 7D5MN22 TYPE:. RTF, txt.

    but it will not find the two types of files.  I can do one or the other:

    content: 7D5MN22 TYPE:. RTF

    or

    content: 7D5MN22 TYPE: txt.

    but I can't do the research on both.  Is there a way to do it, or this feature has been taken away?

    I would appreciate help, even if it's to say that I am thick and the answer is obvious.

    The value separated by commas, that I can't go to work on my XP machine, but the method mentioned by the larch GOLD seems to work well.

  • How to get the use of database tables/columns in the table of edge/analysis?


    Hi all

    Anyone has an idea on how to get the tables in DB/colomns usaged in edge/analysis table in OBIEE 11 G?

    Thanks in advance!

    Anne

    You can try to generate a report of Catalog Manager for analysis / SA want to create the line and your RPD you can go to utilities > documentation of the repository and get the domain you want to and get all the mappings in Excel format.

    I hope this helps.

    SVS

  • Inserting data in several related tables using the database

    Hello world
    I'm working on a BPM application using Oracle BPM 11.1.1.5.0 and JDeveloper 11.1.1.5.0.

    In my database, I have two tables, loan and guarantee that are related by a field named employeeID (PK on loan) and FK in warranty.
    Each line can have several lines of guarantee.

    At this point, I'm doing an entry form for the user to insert data in the two tables.

    I did successfully before with a single table that has no relations.

    The way I'm doing here is, after the creation of the database successfully adapter, a type of LoanCollection is created in the types module, which can be used to create business objects and data objects of.

    The problem is when I create an object of type loanCollection process data and then create a UI generated automatically on that basis, only the fields in the primary table (the Table of loan) appear in the form.
    On the other hand, if I create a business object based on the LoanSchema, the form for all of the two tables is created automatically (the loan as a form, the guarantee in a table), but then, when I try to access it in the section processing service mission which calls the database adapter, I have no access to such.
    In fact, the only type which can be used in the service task is the process based on the loanCollection data object.

    To summorize, I have to use the type of business for my UI object to include all the fields in both tables, so I have to use the data object from the collection process in the transformation of service task dialog box.
    And I can't find a way to map to another.

    Can someone help me with this please?
    Thank you very much

    Try to follow these steps.

    1. create a new module in your catalogue our BPM project management section
    2. in this new module create 3 Business Objects - (LoanBusinessObject, GuaranteeBusinessObject and GuaranteeArrayBusinessObject)
    3. Add the attributes appropriate to the LoanBusinessObject and the GuaranteeBusinessObject so that they mimic your database tables, then to the GuaranteeArrayBusinessObject add an array of type attribute GuraranteeBusinessObject
    4. now you need to create two process data objects, type loanProcessObject LoanBusinessObject and type guaranteesProcessObject GuaranteeArrayBusinessObject
    5. as inputs to your human task adds the loanProcessObject and guaranteesProcessObject, these should now be available in your data controls and can be used to auto generate the form
    6. in your dbadapter you'll then use XSL Transformation and use for each so that it will write the data to the ready table and all the line items of warranty for the warranty table.

  • CAN Web site created using Adobe portfolio to be seen by the search engines?

    I have portfolio Adobe plan to photograph my Adobe, but could not locate the site I created using Google .  CAN Web site created using Adobe portfolio be seen by search engines?

    I posted this question here, because I have received no response on the sections creative cloud or Adobe Portfolio of this Web site.  Please do not move.

    When you create a Web site, you must wait while it can spread through the internet. It will be accessible using the url.

    Regarding the Google search, they have an article on how to make it easier to be found by their bot. For example, you add a small file to your website, then submit to Google, this is the place for the bot to find. This file then gives the url for each Web page and other data which may be relevant for display in the search page.

    This process will speed up how long it takes to be on the search page, but is not necessary. If a link to your site is another site, the bot will find and crawl your site later.

    However, if Google finds your link on several other sites he could assume it's spam and block it. So be very careful how often your site appears on other sites and check that he is allowed to do on this site. Some allow, some don't, and some are ok with it if it is relevant to their site.

  • Table of contents search function can search through several SCO files?

    Table of contents search function can search through several SCO files?

    My project is a combination of 6 different SCOs, which I wrapped using the Multi-SCO in CC 6.1. The client requested a Table of contents (TOC) which can be consulted; However, our tests indicate that, even if you create a table of contents in the Multi-SCO mode, you are unable to search across multiple SCO files. That's why when you use the function search to search for a specific term, you are only able to search within the current OCS (active/charge). Is there a work around that?

    Thank you!

    N ° research works in the course of the OCS.

  • CRUD using ADF fails to update the database table

    Hi all

    I am very new FAD and JDev. I use JDev 11.1.1.2.0 and oracle 10g DB.

    I created the necessary
    1 model, view, control files of data using JDev to a DB table control.
    2 .jspx file having a "Panel Accordin ' and a page layout"Panel formLayout"to display the fields in table required on the page."

    I use Panel corre layout to display data with buttons of browsers and works very well.
    In the the Panel layout form, after posting the fields I added the button 'submit '. I've linked this button with the operation "Commit" by drop and simple drag.
    PS: I've added the fields by simple drag / drop control of the data file maps to the table in question.

    The performance of the page I find things work fine until I want to use the submit button. It just updates the UI front, but when I check in my database table I find that it has not been updated.

    I am naïve. Pls Guide.
    A site with step - by - development of end to end step will be very large.

    Desperately waiting to get this resolved.

    Thank you all

    Published by: user8925296 on January 16, 2010 02:13

    The performance of the page I find things work fine until I want to use the submit button.

    See if your button submit has an EL expression in its property "disabled".
    Depending on how you want it, delete this EL expression or add partialTriggers button to make it refresh partially each time that a field can be changed on your page changes...
    (Assuming it's all ADF faces that you use. Also, see more here: Re: activate/register button )

  • Suddenly, when I search using the address field, I am is more directed directly on the site I look for ex-BBC, as I was before. To place a web page

    When I search using the address field, I am is more directed directly on the site I look for ex-BBC, as I was before.

    Instead Google web page appears with a list of proposals, and I have to click on the link to the BBC it to get on the site.

    Ways you can give me the code to insert in the "topic: config" keyword. URL

    r

    Take a look at this module.

    https://addons.Mozilla.org/en-us/Firefox/addon/keywordurl-hack/

  • Google site search keeps all loading on all sites that use it. However, the same sites load with IE.

    Google site search just keep loading forever on all sites that use it. But IE works fine on the same sites.

    I'm using FF 11, but it has also been a problem in previous versions. Win7/64 with the latest updates on a computer laptop xps Dell 15z. CORE I5

    Hello

    Please check if this happens in a new profile. If it's good, you can later copy the necessary personal data of the old profile. Firefox stores your personal data and settings to another separate location of the files/folder. A new profile would default Firefox settings (Tools (Alt + T) > Options, and topic: config ) and usually also would be vacuum of Extensions and themes (appearance) in tools > Add-ons) and their parameters. In addition, a new profile would have no previous website stored data/settings etc, (Tools > clear recent history).

    Profiles Howto

    Files & profile folder

    Subject: config entries

  • How to create and use the database in the development of a mobile Web site?

    Hello

    I am a beginner in the creation of Mobile-based Web sites. So, please can someone help me as I want to use a database for a website of the mobile base. How can I proceed further on this issue? I know what database I use and how a connection can be made to it and using what language?

    Please do not respond.

    Thank you and best regards,

    Richa Bhatia

    If you are a Microsoft Developer, you can use ADO.NET to access the database.  This is because it is the technology on the server side and is running on the web server and not to the device.

    You can create your Web site by using one of the web technologies side server such as ASP.NET, JSP, PHP etc. Any technology that will serve up to HTML will work.

    When developing web sites for mobile devices, you will quickly realize that it is not a "one size fits all".  Each set of HTML markup will probably have to be customized for each of the mobile that you are eager to target.  And then, for each version of the operating system for mobile devices there are differences in sizes of rendering, JavaScript and HTML/CSS screen capabilities.

    My best analogy is thinking differences between desktop browsers such as IE5/6/7/8, Firefox, Chrome, Opera, Safari vX.Y.  Then multiply that by about 10 fold when it comes to differences in mobile browsers.

    Have a Web site that supports all mobile devices with a set of means HTML you'll probably adopt an approach more common denominator based on lowest mobile device features, you want to support.  The alternative is create targeted for each mobile user experiences.

  • Manage several emails, I use several accounts (Yahoo & Hotmail) e-mail, but is there a way to control these accounts of e-mail to a Web site or anything that is free?

    Manage several emails, I use several acconts e-mail (yahoo & hotmail), but is there a way to control these email account from a Web site or something that free s and respect privacy, pls kindly include G mail other than the 2 aforementioned accounts. TQ.

    original title: manage several E-mails.

    Download a real email client (application) to connect your email on your local computer.  In this way, you can manage all the emails in one application and even keep local e-mail backups if you want.

  • How to use several adf 12 shape and insert the form data in to table during the click on "submit" button

    How to use several adf 12 shape and insert the form data in to table during the click on "submit" button. Can we use several form from adf or not?

    Make sure that you dragged the VO based EO.

    Also make sure that the VO attributes based EO Updatable property.

    The query according to VO is used only to add LOV to the column of the original VO ModelId.

    See you soon

    AJ

  • Creating XML file using data from database table

    I have to create an xml file by using the data in the table of multiples. The problem that I face is data are huge it's millions, so I was wondering is it possible efective for the creation of an XML of this type.

    It would be great if you can suggest an approach to achieve my requirement.

    Thank you
    -Vinod

    An example of the forum: Re: how to generate the XML from the database table

    Published by: Marco Gralike on 18 October 2012 21:41

Maybe you are looking for