php - Getting dependant data from two tables -
i'm trying create page uses session data find user in database , sends events user has signed to. i'm bit of newbie , have got confused at. using 2 different tables data, , i'm getting confused , believe errors occurring. in advance.
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <?php session_start(); ?> <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> <?php $username = $_session['username']; $email = $_session['user_email']; $con=mysqli_connect("localhost","emuas","******","emuas_signup"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } echo "<table> <tr> <td> logged in as:</td> </tr> <tr> <th>" . $username . "</th> </tr> <tr> <td> <form action='logout.php' method='post'> <input type='submit' value='logout' > </form> </td> </tr> <tr> <th>events attending:</th> </tr>"; $find = mysqli_query($con,"select * sign_up_test user = '$username'"); while($find_row = mysqli_fetch_array($find)){ //get event id $eventid = $find_row['eventid']; //use event id event name $result = mysqli_query($con,"select * test eventid = '$eventid'"); //insert event name table link page name while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td> <a href='http://www.emuas.co.uk/members/sign_up_sheets/s" . $row['pagename'] . ".php'>" . $row["eventname"] . "</a> </td>"; echo "</tr>"; } } echo "</table>"; ?> <body> </body> </html>
Comments
Post a Comment