Jump to content


Photo

Use PHP for (HTML to CSV conversion)


  • Please log in to reply
No replies to this topic

#1 mouncifb

mouncifb
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 13 April 2006 - 11:54 PM

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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users