SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Feb 2010
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question MySQL dynamic select and display on screen

    I have been making an RSVP service for my parents upcomming wedding. I have been sucessful with all the other codes and scripts but i am having trouble with something. On a viewguests.php page, i want to modify this so my mum can go on and see a list of people who have responded through a form that posts data to the table. At the moment, I have 4 test people in the table of guests, and when i go to viewguests.php?eventid=12345 (the php page to view the guests) it only displays one result. (When a guest responds they type the event id (field: eventid) and that goes in to the table). So what i want to do is have all of the rows in the table with the event id 12345 show up, not just one result.

    If anyone can help me, I will be very happy.

    Here is the script i already have:

    <?php

    $dbh = mysql_connect("localhost","username","passwork") or die(mysql_error());
    mysql_select_db("database");

    $eventid = $_GET['eventid'];

    $event_sql = "SELECT * FROM table WHERE eventid=$eventid LIMIT 0, 30";
    $event_query = mysql_query($event_sql) or die(mysql_error());
    $rsEvent = mysql_fetch_assoc($event_query);
    while($result = mysql_fetch_array($event_query));

    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>

    <body>
    <?php do { ?>
    <table width="800" border="1" cellspacing="0" cellpadding="0">
    <tr>
    <td width="133"><?php echo $rsEvent['id']; ?>&nbsp;</td>
    <td width="133"><?php echo $rsEvent['name']; ?></td>
    <td width="133"><?php echo $rsEvent['email']; ?></td>
    <td width="133"><?php echo $rsEvent['phone']; ?></td>
    <td width="133"><?php echo $rsEvent['notes']; ?></td>
    </tr>
    </table><?php } while($rsEvent = mysql_fetch_assoc($event_query)) ?>
    </body>
    </html>

    Thank You.
    Jordan Smith.
    Last edited by nzol; Feb 2, 2010 at 15:08. Reason: Added Code


Tags for this Thread

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
  •