Page 1 of 1

displaying data using php coding

Posted: Mon Feb 23, 2004 8:39 am
by picasso
i have created a form which user can search data by keying in the name or ID. The problem is that, how am i able to show out wat the user key in matches to the querry they enter using php coding. My databases have been created also have this field username, userid, userdept. Hope there is someone to help me!!!! :(

Below is the form i ahve created

Code: Select all

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="get" action="view_record.php">
  <b>Search of Student data </b> 
  <p>Student Name 
    <input type="text" name="username">
  </p>
  <p>Student ID 
    <input type="text" name="userid">
  </p>
  <p> 
    <input type="submit" name="Submit" value="Search">
  </p>
</form>
</body>
</html>

Posted: Mon Feb 23, 2004 5:05 pm
by tim

Code: Select all

$sql = "SELECT * from table_name WHERE username='$username'";
$result = mysql_query($sql);

Posted: Wed Feb 25, 2004 7:12 am
by picasso
Thanks tim for ur help :D