
October 16th, 2003, 10:36 PM
|
|
|
|
Join Date: Apr 2007
Location: Tucson, Arizona, US
Posts: 16
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
RE: How To?
I'd say if you have a file... upload the file contents into a table in MySQL -- LOAD DATA LOCAL INFILE from the MySQL manual or some such depending on how you get to the MySQL server.
Then use php to process the form and return the HTML.
Just a sketch but it should get you started.
Assuming PHP and MySQL on the server.
Assuming table transactions with primary key account_num
HTML form is sent to client with action="getTrans.php" the php file which will process the script.
Client fills in the form and clicks submit
Here's the connection and formatting stuff straight out of the php manual modified a bit for the situation. This would be in the getTrans.php file on the server.
php Code:
Original
- php Code |
|
|
|
/* Connecting, selecting database */ $html="<html><head><title>RESULTS</title></head>"; $link = mysql_connect("mysql_host", "mysql_user", "mysql_password") or die("Could not connect"); $html.= "<h4>Connected successfully</h4>"; /* Performing SQL query */ $query = "SELECT * FROM transactions where account_num='".$_POST['account_num']."'"; /* Printing results in HTML */ $html.= "<table>n"; /* do header rows for labeling */ $html.="<tr> <th>Date</th> <th>Amount</th> <th>Payee</th> <th>Transaction Number</th> </tr>"; /* cycle through results returned - format them */ $html.= "<tr>n"; $html.= "<td>".$line['date']."</td> <td>".$line['amount']."</td> <td>".$line['payee']."</td> <td>".$line['transaction_num']."</td>"; $html.= "</tr>n"; } $html.= "</table></body></html>n"; /* Free resultset */ /* Closing connection */ /* send page to client */
Cheers,
Greg
|