SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Feb 2013
    Location
    S****horpe, United Kingdom
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Keywords search over multiple tables

    Hi folks, I have a normalized database which is based on a learning environment.
    I would like to be able to search for a selection of keywords which are in a table called 'C_Search' and use them to pull up the course details which stored in 'C_Info'. I have a basic search function but it is driving me crazy with how to get the keywords involved as I am new to all this and trying to learn as I go along...sometimes we need help

    The code I have so far is:

    PHP Code:
    <?php
     
    mysql_connect 
    ("localhost""jimbooth","test1")  or die (mysql_error());
    mysql_select_db ("jimbooth_database");

    $term $_POST['term'];
     
    $term $_POST['term'];
     
    $sql mysql_query("select * from C_Info where C_Description like '%$term%'");

    if (
    mysql_num_rows($sql) <= 0) {
    // no results
    echo 'Sorry, No results found.';
    } else
    while (
    $row mysql_fetch_array($sql)){
        echo 
    '<br/> Course Info: '.$row['C_Description'];
        echo 
    '<br/> Duration: '.$row['C_Duration'];
        echo 
    '<br/> Entry Requirements: '.$row['C_Entry_Req'];
        echo 
    '<br/> Course Cost: '.$row['C_Cost'];
            echo 
    '<br/> Course Progression: '.$row['C_Progression'];    
        echo 
    '<br/><br/>';
        }
    ?>
    Could anyone shed any light on this for me and point me in the right direction please
    Last edited by cpradio; Feb 27, 2013 at 06:30. Reason: Added [php] tags


Bookmarks

Posting Permissions

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