Jump to content

Archived

This topic is now archived and is closed to further replies.

mouncifb

Use PHP for (HTML to CSV conversion)

Recommended Posts

I have a table wihtin an HTML page named usersdata.html and also have a mysql table in database that looks like this:

----------------------------------
id username
----------------------------------
0 user1
1 user2
---------------------------------

the table within the HTML page stored in /var/www/html/usersdata.html

<table>
<tr><th>Username</th><th>head1</th><th>head2</th><th>head3</th></tr>
<tr><td><a href="users.php?showuser=y&account=user1">user1</a></td><td>1269</td><td>0.00</td><td>0.00</tr></tr>
<tr><td><a href="users.php?showuser=y&account=user2">user2</a></td><td>338</td><td>12.49</td><td>10.64</tr></tr>
</table>


Question: How do I accomplish this by writing a PHP script that should look like this:



<?php

loop fo each user in the mysql table {

while opening and searching through the file "userdata.html" {

match the first corresponding amount for the user ( example user1's amount is 0.00, user2's amount is: 12.49 as shown in the HTML table)
store the match (amount) in a variable "let's say $useramount"
store the variable $useramount in another table ( I can manage to do this myself, just to explain the purpose of doing this)


}


}

?>



Any help will be appreciated, thanks guys!!
mouncifb@yahoo.com

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.