\n"; /* printing table headers */ for($i=0; $i<$fields_num; $i++) { $field = mysql_fetch_field($result); print "{$field->name}"; } print "\n"; /* printing table rows */ while($row = mysql_fetch_row($result)) { print ""; /* $row is array... foreach( .. ) puts * every element of $row into $cell variable */ foreach($row as $cell) print "$cell"; print "\n"; } print "\n"; } if(!empty($_REQUEST['username'])) { $username=addslashes($_REQUEST['username']); /* print $username; */ $q1 = "SELECT fullName FROM User_T WHERE username='$username'"; $r1 = mysql_query($q1); if (mysql_num_rows($r1)==1) { /* user exists */ $row = mysql_fetch_row($r1); print "

$row[0]

"; $q2 = "SELECT email FROM UserEmail_T WHERE username='$username'"; $r2 = mysql_query($q2); if (!$r2) die("Query to retrieve user email(s) failed"); DisplayTable($r2); mysql_free_result($r2); } else print "Sorry user does not exist"; mysql_free_result($r1); } else print("Please provide a username."); ?>