Jump to content

Use PHP for (HTML to CSV conversion)


mouncifb

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.