php3-list | 199807
Date: 07/31/98
- Next message: Richard Lynch: "Re: [PHP3] Strange behavior with Oracle UPDATE"
- Previous message: Richard Lynch: "Re: [PHP3] What is md5?"
- Maybe in reply to: Tom Buck: "[PHP3] more MySQL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Here's a minimalist sample.
I'm not an actual mysql user, so you may need to change the mysql calls slightly...
Untested code follows:
namesearch.php
---------------------
<HTML><HEAD><TITLE>Search</TITLE></HEAD><BODY>
<?php
/* if we are coming back here from a submission, do the search. */
if (isset($firstname)){
$sock = mysql_open("yourhosthere"); /* You may need name/password here... */
if ($sock == 0){
echo("Couldn't open database.<BR>\n");
exit;
}
$query = "select first, last from test where first = '$firstname' and last = '$lastname'";
$result = mysql_Exec($sock, $query);
if ($result == 0){
echo("Query failed.<BR>\n");
echo("$query<BR>\n");
}
$rows = mysql_NumRows($result);
if ($rows == 0){
echo("No matches for:<BR>\n");
}
for ($i = 0; $i < $rows; $i++){
$f = mysql_Result($result, $i, 0);
$l = mysql_Result($result, $i, 1);
echo("$f $l<BR>\n");
}
mysql_close($sock);
}
?>
<! This form will server two purposes.>
<! First, it will appear as the blank form for the search.>
<! When a search has been done, it will show the values typed in.>
<FORM ACTION=namesearch.php METHOD=POST>
First: <INPUT NAME=firstname VALUE="<?php echo("$firstname");?>"><BR>
Last: <INPUT NAME=lastname VALUE="<?php echo("$lastname");?>"><BR>
<INPUT TYPE=SUBMIT VALUE="Search">
</FORM>
</BODY></HTML>
-- -- -- "TANSTAAFL" Rich lynch <email protected>-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3
- Next message: Richard Lynch: "Re: [PHP3] Strange behavior with Oracle UPDATE"
- Previous message: Richard Lynch: "Re: [PHP3] What is md5?"
- Maybe in reply to: Tom Buck: "[PHP3] more MySQL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

