Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
picasso
Forum Newbie
Posts: 5 Joined: Mon Feb 23, 2004 8:39 am
Post
by picasso » Mon Feb 23, 2004 8:39 am
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>
tim
DevNet Resident
Posts: 1165 Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio
Post
by tim » Mon Feb 23, 2004 5:05 pm
Code: Select all
$sql = "SELECT * from table_name WHERE username='$username'";
$result = mysql_query($sql);
picasso
Forum Newbie
Posts: 5 Joined: Mon Feb 23, 2004 8:39 am
Post
by picasso » Wed Feb 25, 2004 7:12 am
Thanks tim for ur help