SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Feb 2010
    0 Post(s)
    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:


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

    $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" "">
    <html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>

    <?php do { ?>
    <table width="800" border="1" cellspacing="0" cellpadding="0">
    <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>
    </table><?php } while($rsEvent = mysql_fetch_assoc($event_query)) ?>

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

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts