Looking for help with a database

Discussion in 'PHP' started by wfa, Feb 16, 2008.

  1. #1
    Hello, first off let me introduce myself. I am a self taught HTML writer. My knowledge of HTML led me to a spot where I became a friend's webmaster. His site was built by someone else, and he used php (which as totally greek to me). I have been able to figure out how to make some things work, but I am working on a page that I can't crack.

    The site now uses a drop down menu to pull a page from the database.
    What I have been requested to do is use images with hyperlinks instead. I would like to use a put the images (100x100 thumbnails) in a table, but ultimately have the same effect.

    The code being used now is:

    <?php $loc = "roster"; @require("include/header.php"); ?>

    <div align=center>
    <form method=get action=roster.phtml>
    <select name=roster class=headline>
    <option value="">Select a wrestler »</option>
    <?php
    @require_once("include/database.php");

    $result = dosql("SELECT * FROM roster ORDER BY refname");
    while($row = mysql_fetch_assoc($result)) {
    print " <option value=$row[refname]>$row[name]</option>";
    }
    ?>
    </select>
    <input type=submit value=View>
    </form>
    </div>

    <?php
    if($roster) {
    $result = dosql("SELECT * FROM roster WHERE refname='$roster'");
    $row = mysql_fetch_assoc($result);

    $bio = str_replace("\n", "<br><br>", $row["bio"]);

    print "<div align=center>\n";
    if($row["has_image"] == "T" || file_exists("../uploads/roster/image/$row[refname].jpg")) {
    print "<img src=http://wfawrestling.com/uploads/roster/image/$row[refname].jpg><br>\n";
    }
    if($row["has_video"] == "T") {
    print "<a href=http://wfawrestling.com/uploads/roster/video/$row[refname].wmv>Click here to watch the entrance video!</a></br>\n";
    }
    print "</div>\n";

    print "<br>\n";
    print "<b>Name:</b> $row[name]<br>\n";
    print "<b>Height:</b> $row[height]<br>\n";
    print "<b>Weight:</b> $row[weight]<br>\n";
    print "<b>Hometown:</b> $row[hometown]<br>\n";

    print "<br>$bio\n";
    }
    ?>

    <?php @require("include/footer.php"); ?>

    Can anybody help figure this out?
     
    wfa, Feb 16, 2008 IP
  2. Possibility

    Possibility Peon

    Messages:
    350
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    So, what exactly do you want? Instead of using the list box, you want to use images as the links? Images can't be used inside of a <select> list, so you'll have to restructure a little bit.
     
    Possibility, Feb 16, 2008 IP
  3. wfa

    wfa Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Possibility,
    That is exactly what I want to do.
    How would I go about getting a script that do what I need?
    The thing with this is that I want to keep the upkeep of the sight simple. It was designed so that my boss could make easy updates to the site. He'd log into a special screen, put in the applicable info, and if there is an image (or even a video) to go with it, he just needed to make sure that the files are named properly, before he would FTP them into the server.
    If I were to be the only person updating the site, I could just set it up using HTML. Create a table, and then hyperlink the images straight to each section of the database (at least I think that I could do that). But I want to keep the site easy for my boss to update himself.
     
    wfa, Feb 16, 2008 IP