SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Non-Member bronze trophy geniusgoalie's Avatar
    Join Date
    Sep 2004
    Location
    Buffalo, USA
    Posts
    979
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    anyone willing to guide me in the right direction?

    Hey, I'm working on a pretty big php script right now, and I am almost finished, but I can't figure out how to do the database search! I self taught myself perl and php, and never had to go this far in depth, and I really am clueless. Could someone just give me an idea of what to do if I want something like this to happen? This is what the database would look like:
    like this: )
    row | A | B | C | D | E | F | G | H | I | (other information) |
    ----------------------------------------------------------
    row1 | 2 | 5 | 6 | 3 | 7 | 9 | 5 | 8 | 9 |
    row2 | 3 | 4 | 5 | 1 | 9 | 7 | 6 | 4 | 0 |
    row3 | 7 | 9 | 8 | 1 | 2 | 3 | 7 | 7 | 0 |
    row4 | 4 | 7 | 1 | 5 | 4 | 5 | 3 | 7 | 8 |

    There would be (many) more rows of course, but for the sake of time I will only list four rows. You would have variables $A, $B, $C, $D, etc. and it would need to display the information (two extra columns) of the rows with the most matching variables.

    I can't find a tutorial that goes this far in depth, I would really like it if someone with a reasonable understanding of mysql and php could help me out, the problem is I don't have any money right now, and to be honest I don't want someone to just "do it" for me. I would, of course, be willing to give a part of the website profit?
    I would be eternally grateful,
    Dan

  2. #2
    SitePoint Addict
    Join Date
    Oct 2004
    Location
    Southwest US
    Posts
    203
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I won't say that this is the best way, but you could write a MySQL query to pull out the rows in the db that have at least one column which matches the corresponding variable. Then in PHP you can loop through the rows returned from your query, and check each row for columns which match the corresponding variables, keeping a count of the columns that match, for each row.

    Once that is complete you would then be able to sort the rows, by the number of matching columns.

    Hope this makes sense...

    Itshim


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
  •