Professional Web Applications Themes

Multiple MySQL tables - PHP Development

Hello! I need some help with tables in MySQL. I am making a colums of articles in my site. It has 3 posters that post articles. I make a little serach page to search for words into articles. I have the sintax below working, but I need to know what is the syntax to it select words from several tables. Every table is for a poster and all tables are in the same DB and have the same fields. --------------- $searchword="SELECT * FROM table WHERE comment LIKE '%$searchstring%'"; --------------- I tried --------------- $searchword="SELECT * FROM table, table1, table2 WHERE selected_row ...

  1. #1

    Default Multiple MySQL tables

    Hello!

    I need some help with tables in MySQL.
    I am making a colums of articles in my site.
    It has 3 posters that post articles.
    I make a little serach page to search for words into articles.

    I have the sintax below working, but I need to know what is the syntax
    to it select words from several tables. Every table is for a poster
    and all tables are in the same DB and have the same fields.

    ---------------
    $searchword="SELECT * FROM table WHERE comment LIKE
    '%$searchstring%'";
    ---------------

    I tried
    ---------------
    $searchword="SELECT * FROM table, table1, table2 WHERE selected_row
    LIKE '%$searchstring%'";
    ---------------

    and even make an ARRY for table, table1, table2 but it does not work.

    Can you help me?

    Sincerely,


    Carlos
    Carlos Marangon Guest

  2. #2

    Default Re: Multiple MySQL tables


    On 17-Aug-2003, [email]area48hotmail.com[/email] (Carlos Marangon) wrote:
    > I need some help with tables in MySQL.
    > I am making a colums of articles in my site.
    > It has 3 posters that post articles.
    > I make a little serach page to search for words into articles.
    >
    > I have the sintax below working, but I need to know what is the syntax
    > to it select words from several tables. Every table is for a poster
    > and all tables are in the same DB and have the same fields.
    >
    > ---------------
    > $searchword="SELECT * FROM table WHERE comment LIKE
    > '%$searchstring%'";
    > ---------------
    >
    > I tried
    > ---------------
    > $searchword="SELECT * FROM table, table1, table2 WHERE selected_row
    > LIKE '%$searchstring%'";
    > ---------------
    >
    > and even make an ARRY for table, table1, table2 but it does not work.
    >
    > Can you help me?
    You need to do a separate query for each table. The select from multiple
    table is used to join related rows in multiple tables together, I don't
    think that's what you want.

    --
    Tom Thackrey
    [url]www.creative-light.com[/url]
    Tom Thackrey Guest

  3. #3

    Default Re: Multiple MySQL tables

    Why three tables for three different posters? Stick it in one table with
    an index on a 'poster' (some int) row?

    Why.

    Carlos Marangon wrote:
    > Hello!
    >
    > I need some help with tables in MySQL.
    > I am making a colums of articles in my site.
    > It has 3 posters that post articles.
    > I make a little serach page to search for words into articles.
    >
    > I have the sintax below working, but I need to know what is the syntax
    > to it select words from several tables. Every table is for a poster
    > and all tables are in the same DB and have the same fields.
    >
    > ---------------
    > $searchword="SELECT * FROM table WHERE comment LIKE
    > '%$searchstring%'";
    > ---------------
    >
    > I tried
    > ---------------
    > $searchword="SELECT * FROM table, table1, table2 WHERE selected_row
    > LIKE '%$searchstring%'";
    > ---------------
    >
    > and even make an ARRY for table, table1, table2 but it does not work.
    >
    > Can you help me?
    >
    > Sincerely,
    >
    >
    > Carlos
    Why? Guest

  4. #4

    Default Re: Multiple MySQL tables

    SQL provides the UNION operation, and it is/will be supported by newer
    MySQL versions. Check your mysql for it!

    Regards!
    Rainer

    Carlos Marangon schrieb:
    > Hello!
    >
    > I need some help with tables in MySQL.
    > I am making a colums of articles in my site.
    > It has 3 posters that post articles.
    > I make a little serach page to search for words into articles.
    >
    > I have the sintax below working, but I need to know what is the syntax
    > to it select words from several tables. Every table is for a poster
    > and all tables are in the same DB and have the same fields.
    >
    > ---------------
    > $searchword="SELECT * FROM table WHERE comment LIKE
    > '%$searchstring%'";
    > ---------------
    >
    > I tried
    > ---------------
    > $searchword="SELECT * FROM table, table1, table2 WHERE selected_row
    > LIKE '%$searchstring%'";
    > ---------------
    >
    > and even make an ARRY for table, table1, table2 but it does not work.
    >
    > Can you help me?
    >
    > Sincerely,
    >
    >
    > Carlos

    --
    ------------------------------------------------
    Rainer Herbst Linux - Registered
    ZEIK User #319157
    Universitšt Potsdam Usual disclaimers applies!
    ------------------------------------------------

    Rainer Herbst Guest

Similar Threads

  1. CFINSERT into multiple tables? MySQL
    By jawwinker in forum Coldfusion Database Access
    Replies: 1
    Last Post: January 24th, 04:30 AM
  2. Cfgrid multiple tables
    By standardCode in forum Coldfusion Database Access
    Replies: 1
    Last Post: September 27th, 04:10 PM
  3. update multiple records in multiple tables from one form
    By Anj01 in forum Coldfusion Database Access
    Replies: 1
    Last Post: May 17th, 05:54 AM
  4. How to Query on multiple tables
    By jt in forum ASP Database
    Replies: 3
    Last Post: May 10th, 10:08 PM
  5. MySQL Multiple tables / results
    By RG in forum PHP Development
    Replies: 3
    Last Post: September 13th, 01:55 PM

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
  •  

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