Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old October 16th, 2003, 07:02 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
How To?

Question: How would one extract data from a file and format it in HTML.

Example: User inputs account number and extracts current month transactions. Transactions are then formatted for HTML display. Would I use PHP, MySQL??? Any help would be appreciated..

Thanks in advance,
Barry.

Reply With Quote
  #2  
Old October 16th, 2003, 10:36 PM
usulix usulix is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Tucson, Arizona, US
Posts: 16 usulix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to usulix
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
  1.  
  2.  
  3.  
  4. /* Connecting, selecting database */
  5. $html="<html><head><title>RESULTS</title></head>";
  6.    $link = mysql_connect("mysql_host", "mysql_user", "mysql_password")
  7.        or die("Could not connect");
  8.    $html.= "<h4>Connected successfully</h4>";
  9.    mysql_select_db("my_database") or die("Could not select database");
  10.  
  11.    /* Performing SQL query */
  12.    $query = "SELECT * FROM transactions where
  13. account_num='".$_POST['account_num']."'";
  14.    $result = mysql_query($query) or die("Query failed");
  15.  
  16.    /* Printing results in HTML */
  17.    $html.= "<table>n";
  18.    
  19.    /* do header rows for labeling */
  20.    $html.="<tr>
  21.    <th>Date</th>
  22.    <th>Amount</th>
  23.    <th>Payee</th>
  24.    <th>Transaction Number</th>
  25.    </tr>";
  26.  
  27. /* cycle through results returned - format them */
  28.    while ($line = mysql_fetch_array($result)){
  29.        $html.= "<tr>n";
  30.        $html.= "<td>".$line['date']."</td>
  31.        <td>".$line['amount']."</td>
  32.        <td>".$line['payee']."</td>
  33.        <td>".$line['transaction_num']."</td>";
  34.        $html.= "</tr>n";
  35.    }
  36.    $html.= "</table></body></html>n";
  37.  
  38.    /* Free resultset */
  39.    mysql_free_result($result);
  40.  
  41.    /* Closing connection */
  42.    mysql_close($link);
  43.  
  44.     /* send page to client */
  45.    echo $html;


Cheers,
Greg

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > How To?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT