*HELP* Search ? ?

Discussion in 'PHP' started by LemonAden, Aug 28, 2006.

  1. #1
    I put up a posting last week asking for something more complex and no one could help so i am trying to make it simple, just so i have something to change on the site.

    We are going to have a database file (can be any format). We want to be able to upload this file to out webhost and make a page on our site that people can go to and search the list we upload. When they search, they will see the product listing, and then the quantity we have in stock. Just something simple for now until we complete the design of our site.

    The database is going to be in our sql server, but we can output it in any format, csv, anything. Just as long as we can get it searchable on our site.

    Thanks in advance@!
     
    LemonAden, Aug 28, 2006 IP
  2. hiredgunz

    hiredgunz Peon

    Messages:
    203
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'm really not sure what you are asking here .. are you saying you'd like someone to write you a script to use a database on your site? If you are using php and mysql, then yes you can easily add a page to your site that will allow users to search the database for whatever info is in there...

    best,

    Jan
     
    hiredgunz, Aug 28, 2006 IP
  3. LemonAden

    LemonAden Peon

    Messages:
    308
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Jan

    I have seen tons of scripts for searching a database out there. I just dont know which steps to take. We would like to generate a report that we can upload to our webhost www.hostgator.com . From that report, we would like a page that would allow our clients to search a product number to see what our quantity is. Simple, no bells and whistles, just that.

    Is there anything like this? Would be awesome to find something free. Thank you in advance

    Aden
     
    LemonAden, Aug 29, 2006 IP
  4. LemonAden

    LemonAden Peon

    Messages:
    308
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    just wanted to update you,,, Our database guy figured out a way to add a database to our webhosts mysql . We now know how to get our database onto the servers... But what scripts are the best for making a PHP page that i can customize which would allow our clients to search the databse?
     
    LemonAden, Aug 29, 2006 IP
  5. prestons

    prestons Peon

    Messages:
    414
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    To clarify things here. Do you just want a one page script that has a search facility of your database then displays the results?
     
    prestons, Aug 29, 2006 IP
  6. hiredgunz

    hiredgunz Peon

    Messages:
    203
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Cool, I'm glad you got the database thing going :)

    There are scripts for making pages from database, but I haven't found a "best" one yet. Personally I would make an html page either using <div> tags or tables, then populate the table cells with the info in the database.

    This would require a connection to the database like this:

    <?php
    $dbhost = "localhost";
    $dbuser = "user_name";
    $dbpasswd = "password";
    $dbname = "database_name";

    // Then the connection code

    $link = mysql_connect($dbhost, $dbuser, $dbpasswd) or die ("Could not connect to MySQL");
    mysql_select_db ($dbname) or die ("Could not select database $dbname");

    // Then get the info you need

    $results=mysql_query("SELECT * FROM your_tablename");
    $myresults=mysql_fetch_array($results);

    // Lets say you have a table and you want to put the info from the "name" field from the database in it
    ?>

    <table>
    <tr>
    <td><?php echo $myresults['name'] ?></td>
    </tr>
    </table>

    This is just a simple example, as you would probably want a for or while loop to get all the names from your database, but it will (hopefully) give you a basic idea of how it would be simpler and you will have more control over the output if you create the page yourself rather than use one of those database connection/page maker programs (free or commercial versions).

    hope this helps,

    Jan
     
    hiredgunz, Aug 29, 2006 IP