Hello people,
Sorry for my lack of knowledge in php. Im really a new to php and im practicing with some php code but for some reason i create 2 tables user and event and after a login enters to his page only get to displays just 1 row of the user event table, I wish if someone could help me or advise whats wrong with the code:
<?php session_start(); include('connect.php'); if(isset($_GET['email'])){ $email_name = $_GET['email']; }else{ echo "No user by that name"; exit(); } //find email $sql = "SELECT * FROM users WHERE email='".$email_name."'"; $query = $db->query($sql); //a user only has 1 row on the users table if($query->num_rows !=1){ echo "No user by that name"; exit(); }else{ $row = $query->fetch_object(); //$id is set to be = users id $id = $row->id; //selects event id and = users id $reminder = $db->query("SELECT * FROM event WHERE id='".$id."'"); //set if = or great than 0 display table if ($reminder->num_rows >=0){ $row = $reminder->fetch_object(); $title = $row->title; $note = $row->note; $date_time = $row->date_time; $alarm_type = $row->alarm_type; $repeat_event = $row->repeat_event; }else{ $title = "n/a"; $note = "n/a"; $date_time = "n/a"; $alarm_type = "n/a"; $repeat_event = "n/a"; } if(isset($_SESSION['logged_in'])&&$_SESSION['email']==$email_name){ $reminderOwner = true; } } ?>
Your Reminders
Hi <?php echo $email_name?>, welcome back. Log out
<?php if(isset($reminderOwner)):?> <?php endif; ?>
<table align='center'border='1' cellpadding='10'>
<tr> <th>Title</th> <th>Note</th> <th>Date & Time</th> <th>Alarm Type</th> <th>Repeat</th> <th>Action</th></tr>
<tr>
<td><?php echo $title;?></td>
<td><?php echo $note;?></td>
<td><?php echo $date_time;?></td>
<td><?php echo $alarm_type;?></td>
<td><?php echo $repeat_event;?></td>
<td><a href="edit.php">Edit</a>
<a href="delete.php">Delete</a></td>
</tr>
</table>
Thanks in advance